Forum Discussion

HerrPowerBI's avatar
HerrPowerBI
New Member
3 years ago

Cumulative sum

Hello

 

I have a dataset where I'm trying to calculate the sum for each row (a cumulative sum). The dataset is ordered by a ranking that goes from 1-10. I have created a measure that works okay, but it's giving the same value for multiple rows when the ranking is the same. I understand why it happens (the filter finds more than one value and sums the table). How can I avoid this from happening? 

 

Here is an example dataset:

IDNameAmountRatingCumulative sum
1Ted100092000
2Morris100092000
3Harry100073000
4William100064000
5Sana100055000

 

 

Measure = CALCULATE(SUM(Sheet1[Amount]),   
      FILTER(ALLSELECTED(Sheet1),
            Sheet1[Ranking] >= Min(Sheet1[Ranking])
      ) 
)

 

 

How can I avoid this problem and still be able to cumulate values based on the descending column for rating?

 

3 Replies