Forum Discussion

46Days's avatar
46Days
New Member
3 years ago
Solved

Error when using cumulative sum with activated filters

I found a solution to my problem but I don't know why the cumulative sum is not working.   I have the following table which brings me some data which I want to add cumulatively, the question is tha...
  • v-zhangti's avatar
    3 years ago

    Hi, 46Days 

     

    You can try the following methods.

    Measure =
    VAR _Cumulative1 = CALCULATE ( SUM ( 'Table'[Value] ),
            FILTER ( ALL ( 'Table' ),
                [# Month] <= SELECTEDVALUE ( 'Table'[# Month] )
                    && [Service] = SELECTEDVALUE ( 'Table'[Service] ) ) )
    VAR _Cumulative2 = CALCULATE ( SUM ( 'Table'[Value] ),
            FILTER ( ALL ( 'Table' ),
                [# Month] = SELECTEDVALUE ( 'Table'[# Month] )
                    && [Service] <= SELECTEDVALUE ( 'Table'[Service] ) ) )
    RETURN
        IF ( ISFILTERED ( 'Table'[Month] ), _Cumulative2, _Cumulative1 )

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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