Forum Discussion

LD's avatar
LD
Frequent Visitor
4 years ago
Solved

Issue on Cumulative Sum

Dear All, please, I have the following Dataset and I would like to measure the cumulative sum by month of [YTD_in/out]_     I try the following structure: Var LastM = SELECTEDVALUE('Y Proj...
  • tamerj1's avatar
    4 years ago

    LD 

    Please use

    =
    VAR LastM = 'Y Projection'[Month]
    VAR CurrentDepTable =
        CALCULATETABLE (
            'Y Projection',
            ALLEXCEPT ( 'Y Projection', 'Y Projection'[Department] )
        )
    RETURN
        SUMX (
            FILTER ( CurrentDepTable, 'Y Projection'[Month] <= LastM ),
            'Y Projection'[YTD_IN/OUT]
        )