Forum Discussion

DarrenLau's avatar
DarrenLau
Icon for Advocate I rankAdvocate I
7 years ago
Solved

Cumulative Sum - What am I missing?

Trying to get a cumulative sum (and then a cumulative percentage) value into a matrix table, but I am just not able to get the correct calculations. Here are 3 different combinations (amongst the man...
  • Ashish_Mathur's avatar
    7 years ago

    Hi,

    Try these measures

    Rank = if([Disti Net Sales] = BLANK(),BLANK(),RANKX(ALL('Sales data'[City]),[Disti Net Sales]))

    Cumulative Disti Net sales = SUMX(TOPN([Rank],CALCULATETABLE(VALUES('Sales data'[City]),ALL('Sales data'[City])),[Disti Net Sales]),[Disti Net Sales])

    Cumulative Disti Net sales (%) = [Cumulative Disti Net sales]/CALCULATE([Cumulative Disti Net sales],all('Sales data'[City]))

    Hope this helps.

  • DarrenLau's avatar
    DarrenLau
    7 years ago

    Hi Ashish_Mathur ,

     

    Thank you for the measures. The cumulative % measure was not working, but I edited it to :-

     

    Cumulative Disti Net Sales % = 
    DIVIDE( [Cumulative Disti Net Sales] ,
        CALCULATE(SUM('Sales Data'[Invoice-Doc]), ALL('Sales Data'[City])) , 
        BLANK()
    )

    And it's showing the cumulative percentages now.