1,495 questions
0
votes
1
answer
48
views
Calculating running total according to multiply groups in Power BI
I need to calculate the total number of piglets born per year and quarter, grouped by cycle. The cycle can range from 1 to 9. So I would like to see this: enter image description here There are some ...
0
votes
0
answers
52
views
Runnin totals does not respect sort of data
I'm trying to calculate running totals of my data, but when I change the order of the rows the field does not change to respect the sequence of data
It seems that they are calculated based on original ...
2
votes
2
answers
229
views
Compute cumulative mean & std on polars dataframe (using over)
I want to compute the cumulative mean & std on a polars dataframe column.
For the mean I tried this:
import polars as pl
df = pl.DataFrame({
'value': [4, 6, 8, 11, 5, 6, 8, 15],
'class': [...
0
votes
2
answers
64
views
Cumulative budget that skips entries that exceed budget
I have a column of item costs listed top-down in order of priority that I need to purchase with $100. I would like to be able to maximize my $100 while maintaining my priority purchases as much as ...
0
votes
3
answers
136
views
Calculate running (cumulative) sum up to a certain value on multiple columns
I've been trying to build a running (cumulative) calculation up to a certain value, on two columns.
The problem I'm facing:
Calculate overtime hours for employees ('EmpID') for a specific pay period (...
1
vote
1
answer
76
views
SQL Query in Snowflake - Calculate Days of Supply
I tried to find the days of supply each day. For example, date 1/23/2025 - It has inventory 700 which already subtract the forecast, 400 on that day. Count how many date of forecast can be covered by ...
1
vote
1
answer
80
views
SQL Query in Snowflake - Calculate Days of Supply each date inventory with forecast each day
I would like to create a column to calculate days of supply on each date inventory and the day and after forecast.
In the example data, 1/23/2025 has 1000 inventory, count how many days of forecast ...
0
votes
3
answers
76
views
Running Max in ArrayFormula of a Query
I am generating a set of data in Google Sheets with a query and then want to get a running max of that data:
My query is as follows:
=query(GOOGLEFINANCE("SPX","price",TODAY()-365,...
0
votes
1
answer
54
views
PowerBI / DAX different dates cumulative on one chart
i can't manage it on my own for 2 days.
I've got 3 tables:
One-off Expenditures:
Title
date
Amount
x
03.07.2024
10000
y
06.08.2024
10000
z
05.09.2024
20000
Weekly cash balance:
date
Amount
02.09.2024
...
0
votes
1
answer
39
views
Get 12 month running total for subgroups in Oracle
I'm trying to get a running 12 month total for data, but changing when values in my fields change. I've made a simpler sql fiddle, for a 3 month running total, for one value in the table. I'm stuck ...
0
votes
1
answer
124
views
Calculation of the current month value from the running total column (reset every year)
I have a table like this:
I want to calculate the current value of a single month in another column as the difference between this month and previous (grouping by "group"), except January ...
0
votes
1
answer
93
views
Sum conditionally and sequentially in Excel?
THE DATA:
I'm trying to create a resource allocation file in Excel and have data structured as follows:
Role
Person
Week 1 Availability
A
Sarah
3
A
John
3
A
Bill
2
A
Emily
0.5
A
Leah
0.5
A
Mike
0.25
...
4
votes
1
answer
154
views
Bottom-up tree structure cumulative sum
CREATE TABLE Emissions (
entityId VARCHAR(512),
parentId VARCHAR(512),
emission DECIMAL,
percentContribution VARCHAR(512)
);
INSERT INTO Emissions (entityId, parentId, ...
0
votes
0
answers
54
views
SQL for hierarchical cumulative sum, but with cumulative sum of child node modified before used to calculate parent's cumsum
entityId
parentId
percentContribution
emission
emission_locationbased
emission_marketbased
cumsum_locationbased
cumsum_marketbased
E1
60
30
60
70
E2
E1
80
20
30
40
E3
E2
80
10
20
10
20
This is a ...
0
votes
1
answer
171
views
Plotting Cumulative Uncertainty Graph over Cumulative Means of Time Series Data in R
I stumbled upon a difficult task in displaying a cumulative plot with cumulative uncertainty over a time series of greenhouse gas fluxes. My raw dataset is composed of 30-minute fluxes data, which was ...
-1
votes
2
answers
94
views
Automate Formula | Excel [closed]
I have quite a complex formula issue that I am trying to fix with excel, not sure if it's possible.
Basically what I want to do is the following for my total treated patients by Product I want to do ...
4
votes
1
answer
110
views
Polars cumulative count over sequential dates
Here's some sample data
import polars as pl
df = pl.DataFrame(
{
"date": [
"2024-08-01",
"2024-08-02",
"2024-08-03&...
1
vote
1
answer
150
views
Distinct cumulative count in PostgreSQL window function
I've got a table with many columns some of these are:
product_id, territory_id, quarter_num (it's a number of a quarter from 1 to 28 for instance).
There are some other columns but they aren't ...
0
votes
1
answer
37
views
thermal sum between two dates, from a daily data frame
I have a data frame with daily temperature data. I would like to calculate the sum in several columns, between two dates from a second data frame and create a output (results) in a new data frame.The ...
0
votes
1
answer
48
views
using dvar int in cumulFunction
I have defined variables Itvs[units][activities][results] as intervals and resAlloc as an integer. The value of resAlloc influences the size of each interval in Itvs. However, when attempting to ...
0
votes
1
answer
93
views
Using T-SQL to get a running total in columns
I am trying to write a T-SQL query to get the running total quantity of columns, basically after everything I have a temp table that has the data I need
SELECT
MQ.[Company],
MQ.[status],
...
2
votes
4
answers
86
views
Using Run-Length Encoding and Generating Sums
I have the following run-length encoding data.
df1 <- structure(list(lengths = c(2L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 3L, 1L), values = c(10, 9, NA, 5, 4, 3, NA, 2, NA, 1, 0, NA, 0)), row....
1
vote
2
answers
196
views
Excel Summing a chart Based on Month
Above is a chart I am trying to sum based on the month. Ie I want a running total that I don't have to adjust as each month changes. I know it may look a little strange but the fiscal year for us goes ...
-1
votes
1
answer
49
views
How to implement recursion in SQL Developer?
I have a table with the following columns:
ID, date, amount, amount2
Column amount2 has values only in the first row. I need to recursively calculate each row of column amount2 using values from ...
1
vote
1
answer
101
views
How to replace negative values with 0 in Cumulative sum calculation in Tableau?
I have to replace the negative values with 0 in Running sum field.
I have created a calculation, like this
IF SUM([Sales]) < 0 THEN 0
ELSE RUNNING_SUM(SUM([Sales]))
END
Table calculation using &...