Forum Discussion
Cumulative year month filter
Trying to creat a cumulative Year month column to display as follows. [Jan], [Jan-Feb], [Jan-Mar] . Any ideas/suggestions are welcome. Thanks
- Anonymous4 years ago
Hi
You can compute a measure that for cumulative values using DAX.
Bellow a forumula that computes the running total for a sales amount based on a date. You can adapt it to your Year/Month table.
Sales RT :=
VAR MaxDate = MAX ( 'Date'[Date] ) -- Saves the last visible date
RETURN
CALCULATE (
[Sales Amount], -- Computes sales amount
'Date'[Date] <= MaxDate, -- Where date is before the last visible date
ALL ( Date ) -- Removes any other filters from Date
)Lookup this article by SQLBi that goes in depth in this subject
https://www.sqlbi.com/articles/computing-running-totals-in-dax/
Hope it helps
1 Reply
- AnonymousNot applicable
Hi
You can compute a measure that for cumulative values using DAX.
Bellow a forumula that computes the running total for a sales amount based on a date. You can adapt it to your Year/Month table.
Sales RT :=
VAR MaxDate = MAX ( 'Date'[Date] ) -- Saves the last visible date
RETURN
CALCULATE (
[Sales Amount], -- Computes sales amount
'Date'[Date] <= MaxDate, -- Where date is before the last visible date
ALL ( Date ) -- Removes any other filters from Date
)Lookup this article by SQLBi that goes in depth in this subject
https://www.sqlbi.com/articles/computing-running-totals-in-dax/
Hope it helps