Forum Discussion

Zahin's avatar
Zahin
Frequent Visitor
3 years ago
Solved

Calculate cumulative sum for a selected date

Hello, I want to calculate cumulative sum for a specific date range. It should also have the total sum until the start date. Example table:   Now if I want to see the cumulative sum for...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Zahin ,

    I have created a simple sample, please refer to my pbix file to see if it helps you.

    Create a meausre.

    Measure =
    VAR _max =
        MAXX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
    VAR _min =
        MINX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
    VAR _re =
        CALCULATE (
            SUM ( 'Table'[amount] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Month] <= MAX ( 'Table'[Month] ) )
        )
    RETURN
        IF (
            MAX ( 'Table'[Month] ) >= _min
                && MAX ( 'Table'[Month] ) <= _max,
            _re,
            BLANK ()
        )
    

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.