Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Cumulative Sum is not working as expected

Hi All,         1.  I have written a mesure like below to get the cumulative sum   2. Its working as expected when no field is added in the columns section like below     3. But my ...
  • v-jingzhang's avatar
    v-jingzhang
    4 years ago

    Hi Anonymous 

     

    Add a Date table to your model and connect it to 'F/Unrealeased_PO' table on date columns. Then use Year and Month columns from Date table into the matrix as Rows fields. Then use below measure. I create a sample pbix for your reference.

    CumulativeTotal = 
    VAR _date = MAX ( DimDate[Date] )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Total Purchase] ),
            ALL ( DimDate[Date] ),
            DimDate[Date] <= _date
        ) + 0

     

    Best regards,

    Jing