Forum Discussion

Samarth-Borade's avatar
Samarth-Borade
Frequent Visitor
3 years ago
Solved

Revverse cumulative error

RevCum_Revenue123 = VAR RunningTotal= CALCULATE([sss], FILTER(ALL(grp[Rev]),grp[Rev]>=MIN(grp[Rev])))
RETURN IF(ISBLANK([sss]),BLANK(),RunningTotal)
 
here [sss] = SUM(grp[Rev])
 
when i remove customer code, it will only show the entire sum.I want to show the reverse cumulative ,
i.e in descending  order: 9031 then 9031+8984 then 9031+8984+4792.
  • tamerj1's avatar
    tamerj1
    3 years ago

    Samarth-Borade 
    Please refer to attached sample file with the proposed solution

    RevCum_Revenue = 
    VAR CurrentRevenue = 
        SUM ( 'Table'[Revenu] )
    VAR T1 = 
        SELECTCOLUMNS ( 
            ALLSELECTED ( 'Table'[Customer Cod] ),
            "@Revenue", CALCULATE ( SUM ( 'Table'[Revenu] ) )
        )
    VAR T2 = 
        FILTER ( T1, [@Revenue] >= CurrentRevenue )
    RETURN
        SUMX ( T2, [@Revenue] )

4 Replies

      • tamerj1's avatar
        tamerj1
        Community Champion

        Samarth-Borade 
        Please refer to attached sample file with the proposed solution

        RevCum_Revenue = 
        VAR CurrentRevenue = 
            SUM ( 'Table'[Revenu] )
        VAR T1 = 
            SELECTCOLUMNS ( 
                ALLSELECTED ( 'Table'[Customer Cod] ),
                "@Revenue", CALCULATE ( SUM ( 'Table'[Revenu] ) )
            )
        VAR T2 = 
            FILTER ( T1, [@Revenue] >= CurrentRevenue )
        RETURN
            SUMX ( T2, [@Revenue] )