Forum Discussion
cumulative for certain period
- 10 years ago
oscarII - OK played with this a bit, tested some things out and fixed a column format issue on my end. Here is what I came up with that I believe will get you what you want:
Cumulative 2 = CALCULATE ( SUM ( 'Invoice lines'[Sales] ), FILTER ( ALLSELECTED(BI-Dates), 'BI-Dates'[Date] <= MAX ( 'BI-Dates'[Date] ) ) )The ALLSELECTED restricts the table returned to only the time range selected. I was able to put BI-Dates[Date] and Cumulative 2 in a table and watch the running total add up each day. I also used a [Month] column from BI-Dates and was able to get different (correct) cumulative totals for January versus February.
oscarII - OK played with this a bit, tested some things out and fixed a column format issue on my end. Here is what I came up with that I believe will get you what you want:
Cumulative 2 = CALCULATE (
SUM ( 'Invoice lines'[Sales] ),
FILTER (
ALLSELECTED(BI-Dates),
'BI-Dates'[Date] <= MAX ( 'BI-Dates'[Date] )
)
)The ALLSELECTED restricts the table returned to only the time range selected. I was able to put BI-Dates[Date] and Cumulative 2 in a table and watch the running total add up each day. I also used a [Month] column from BI-Dates and was able to get different (correct) cumulative totals for January versus February.
- Maxime9 years ago
Advocate I
You should rather compare the Maximum's date to today's date like this:
Cumulative 2 = CALCULATE ( SUM ( 'Invoice lines'[Sales] ), FILTER ( ALLSELECTED(BI-Dates), 'BI-Dates'[Date] <= MAX ( 'BI-Dates'[Date] ) && MAX ( 'BI-Dates'[Date] ) <= TODAY() ) )- brianhackett59 years ago
Helper I
Hi there,
I need to have the cumulative kilometres from another table showing on this table. The cumulative kilometres would need correspond with the dates on the above table.
Is this possible?
- oscarII10 years agoNew Member
Greg_Deckler... Just one more point on this - the cumulative amount runs past the end of the available data and you end up with a graph looking like this:
Is there any way that the formula can be amended to only show where there is data against that particular date?
Thanks for the help.
- greggyb10 years ago
Resident Rockstar
Cumulative 2 = CALCULATE ( SUM ( 'Invoice lines'[Sales] ), FILTER ( ALLSELECTED(BI-Dates), 'BI-Dates'[Date] <= MAX ( 'BI-Dates'[Date] ) && 'BI-Dates'[Date] <= TODAY() ) )Just remove all dates greater than the system date from the date dimension. && is the logical and operator.
- aruntd7710 years ago
Helper I
Hi,
I tried your approach to eliminate the future dates, however it is not filtering.
Cumulative Actual Units = CALCULATE(SUM('DWH W_ORDER_HEADER_D'[Sold Count]), FILTER(ALLSELECTED('DWH W_DAY_D'), 'DWH W_DAY_D'[CALENDAR_DATE] <= MAX('DWH W_DAY_D'[CALENDAR_DATE]) && 'DWH W_DAY_D'[CALENDAR_DATE] <= TODAY()))
Please help
Thanks
Arun
- oscarII10 years agoNew Member
Greg_Deckler - Thanks very much, that's working perfectly now :smileyhappy:
- dwolfe10139 years agoRegular Visitor
Hi! I am trying to use your solution and it does not seem to work for me.
I have tried both of the following expressions, and both return the same results. The values returned are cumulative back to the start of the query, rather than cumulative for only the date range shown in the visual.
Any ideas why the addition of the allselected function does not appear to be affecting the returned totals?
Thank you!
cumulative total=
CALCULATE (
SUM ( 'table'[column]),
FILTER (
ALLSELECTED ( 'Date'[Date] ),
'Date'[Date] <= MAX ( 'Date'[Date] )
)
)-or-
cumulative total=
CALCULATE (
SUM ( 'table'[column]),
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= MAX ( 'Date'[Date] )
)
)