Forum Discussion

Mayugi's avatar
Mayugi
Regular Visitor
4 years ago
Solved

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

  • Anonymous's avatar
    Anonymous
    4 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

  • Anonymous's avatar
    Anonymous
    Not 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