Forum Discussion
Anonymous
6 years agoNot applicable
Cumulative Sum, DAX
Hi all, I'm having trouble creating a calculated column (or measure) in DAX that will return a running total based on groups. The data I'm working with looks like this: I need the Re...
- Anonymous6 years ago
This is my ussual way of calculating running totals but it should do the trick for you aswell.
Calculated column = CALCULATE ( SUM ( 'Table'[Requirement quantity] );
// Calculate over the entire table ALL ( 'Table' );
// Filter where item numbers are the same 'Table'[Item Number] = EARLIER ( 'Table'[Item NumberT] );
// Filter the order for calculating 'Table'[Index] <= EARLIER ( 'Table'[Index] ) )Always here to help.
Kind regards
Joren Venema
Nathaniel_C
6 years agoCommunity Champion
Total Requirement measure = SUM(table[Requirement Quantity]) ====================================================== Total Cumulative =
VAR MaxDate =
MAX ( table[Requirement Date] ) -- Saves the last visible date
VAR ReqQuantity =
CALCULATE (
[Total Requirement measure],
-- Computes hours
table[Requirement Date] <= MaxDate,
-- Where date is before the last visible date
ALLEXCEPT (
table,
table[Buyer Group ]
)
)
RETURN
ReqQuantity
Hi Anonymous
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel