1,495 questions
7
votes
3
answers
19k
views
Excel - How do I create a cumulative sum column within a group?
In Excel, I have an hours log that looks like this:
PersonID Hours JobCode
1 7 1
1 6 2
1 8 3
1 10 1
2 5 3
2 3 ...
3
votes
2
answers
84
views
Distribute value to fill and unfill a Polars column based on a given condition
The problem:
I want to distribute a value that can be positive or negative from one row into multiple rows, where each row can only contain a specific amount, if the value to distribute is positive it ...
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 ...
3
votes
2
answers
16k
views
Cumulative sums
I want a report which shows the daily number of tickets per shift and also the to-date total.
Here's the query I have which shows the first 5 columns below:
SELECT
TO_CHAR(DTTM,'YYYY-MM-DD') as &...
2
votes
2
answers
385
views
SQL Server pivot with running tally total row
I have a table that I am showing as a pivot. The table has a category and sub-category column. I want to add a total row for each category with a running tally with an initial value coming from ...
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 ...
1
vote
4
answers
840
views
What's the highest value that can be accurately represented to one decimal place by a 32-bit float?
Question: what is the highest value that can be accurately represented to one decimal place by IEEE-754 32-bit floating point data?
Background: I've found this question which asks: Which is the first ...
0
votes
1
answer
51
views
Cumulative Measure Flatlines After Current Date
I am visualizing the % Completion for a project. The visual I've created shows two data series - one for actual % complete (Cumulative_Complete) and another for the planned % complete. The plan series ...
0
votes
2
answers
227
views
Calculate a running 7-day total in LibreOffice Calc, where dates may have multiple entries
How do I write a formula that I can copy and paste into a column in a LibreOffice Calc spreadsheet so that each cell displays a running 7-day total of the values in a different column. Column A ...
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 ...
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
311
views
Dividing two running totals in PostgreSQL
I have three columns, id, opening_date and termination_date.
I want to write a query that performs this:
total number of terminated up until a specific date ÷ total number of opened up until that same ...
0
votes
1
answer
76
views
Cumulative sum with overrides on condition
I'm trying to calculate the balance (the level) of an inventory over time and have incoming and outgoing quantities as input (and a category for each type of inventory). Usually I would calculate ...
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
...
1
vote
1
answer
114
views
Running total (cumulative sum) optimization
I have to use running total value for the parameter "users". Here is the script (simplified):
with us_data as (
select
count(us.*) as us_reg,
count(us.*) filter (where status =...
-2
votes
1
answer
44
views
End month balance and calculate supportable
I tried looking for some solution here, but still stuck.
WITH MyData AS (
SELECT 'Jun 2024' AS [date], 'A' AS [group], 69 AS Supply, 0 AS Forecast
UNION ALL SELECT 'Jul 2024', 'A', 61, 0
...
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
...
-5
votes
1
answer
108
views
Understanding Kadane's Algorithm Implementation and Integer Limits in C++ [closed]
I'm working on implementing Kadane's Algorithm to find the subarray with the maximum sum. I have some questions about the implementation and the use of integer limits:
#include <bits/stdc++.h>
...
0
votes
2
answers
65
views
Weighted hierarchical cumulative sum
I don't know if I'm using the correct terminology, but I'm trying to find the cumulative sum of each node in a tree structure, but the children node only contribute a percentage of its cumulative sum ...
0
votes
2
answers
60
views
Calculated column in SQL based on multiple column matches between two tables and cumsum
Calculated column in SQL based on multiple column matches and cumsum between two tables
I have two tables.
Table 1: has 4 columns as shown below.
X
Y
A( in days)
B(sum)
a
aa
7
a
bb
9
b
aa
36
c
dd
29
...
-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 ...
1
vote
1
answer
123
views
Rolling cumulative product over aggregated data in PySpark
In the following PySpark dataframe I am trying to multiply values in column top to bottom (as if I was using F.product function) but instead of row by row calculation I have subgroups of identical ...
0
votes
0
answers
56
views
PySpark cumulative sum of contiguous rows over partition
I have a table that holds reports that come in for different entities, and the state the entity is in at the time of the report. It is important to know the total duration of each occurrence of an ...
1
vote
2
answers
7k
views
Crystal Report Running Total
I am creating a report (screenshot is attached below) in which I have to show running total of column Balance. This balance column value is generated by adding or subtracting dr and cr column value. ...