Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BjoernSchaefer
Helper II
Helper II

Un-cumulate Cumulative Values

Hello Everybody,

 

 

I'm dealing with a little issue right now. I have a datamodel containing a Fact-Table with several Dimension-Tables. The Fact-Table contains transactions for Accounts over the last two years. The Date ist always the first of the month. The Problem is: The database only delivers cumulative values by month and not the actual values for each month. Now i need to "un-cumulate" the values for the months. Has anybody got an idea how to solve this? See some example data below and thank you very much for every response i'm gettin'.

 

Kind regards

 

BjoernSchaefer

DataModel.pngFacts.png

 

 

 

1 ACCEPTED SOLUTION

@BjoernSchaefer Here is the steps I've followed to solve this.

 

Step 1 : Add an Index Column (start from 1) in "Power Query"

 

Step 2 : Add an additional column using "New Column" as below

 

RankAccount = RANKX(FILTER(Test04UnCumm,Test04UnCumm[Account]=EARLIER(Test04UnCumm[Account]) && Test04UnCumm[Date] = EARLIER(Test04UnCumm[Date])),Test04UnCumm[Index],,ASC)  

Step 3 : Finally, here is the magical column we are looking for

 

UnCummVal = 
VAR _PrevCummVal = LOOKUPVALUE(Test04UnCumm[CummVal],Test04UnCumm[Account],Test04UnCumm[Account],Test04UnCumm[Date],Test04UnCumm[Date]-1,Test04UnCumm[RankAccount],Test04UnCumm[RankAccount])
RETURN IF(_PrevCummVal=BLANK(),Test04UnCumm[CummVal],Test04UnCumm[CummVal] - _PrevCummVal) 

The output will be as below :

 

image.png

 

Uhhh !! Nice one 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

6 REPLIES 6
PattemManohar
Community Champion
Community Champion

@BjoernSchaefer Could you please post the sample data (Copiable format) and expected output which will help to understand the issue bit more detail.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




AccountDateValue CumulativeDescriptionExpected OutcomeDescription2

175301.01.2017157<- These are the running totals by month157 
175301.01.2017152 152 
175301.01.2017177 177 
175301.01.2017120 120 
175301.01.2017138 138 
175301.01.2017129 129 
175301.01.2017141 141 
175301.01.2017118 118 
175301.01.2017175 175 
144601.01.2017137 137 
144601.01.2017181 181 
144601.01.2017165 165 
144601.01.2017114 114 
144601.01.2017165 165 
144601.01.2017180 180 
144601.01.2017115 115 
144601.01.2017128 128 
144601.01.2017181 181 
144601.01.2017182 182 
144601.01.2017190 190 
175302.01.2017301 144<- This is the value i need. It's the difference to January 1st.
175302.01.2017273 121 
175302.01.2017367 190 
175302.01.2017270 150 
175302.01.2017328 190 
175302.01.2017267 138 
175302.01.2017307 166 
175302.01.2017229 111 
175302.01.2017364 189 
144602.01.2017297 160 
144602.01.2017360 179 
144602.01.2017296 131 
144602.01.2017271 157 
144602.01.2017269 104 
144602.01.2017302 122 
144602.01.2017289 174 
144602.01.2017326 198 
144602.01.2017371 190 
144602.01.2017336 154 
144602.01.2017304 114 

@BjoernSchaefer Just to confirm, is this what you are expecting as output in a new table

 

1753 01.01.2017 157
1753 02.01.2017 144

 

Or you want to display in new column as mentioned above





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




@PattemManohar, this is correct. I need an extra column. But i'm not able to figure out how to do that. Thank you very much for your responses.

@BjoernSchaefer Here is the steps I've followed to solve this.

 

Step 1 : Add an Index Column (start from 1) in "Power Query"

 

Step 2 : Add an additional column using "New Column" as below

 

RankAccount = RANKX(FILTER(Test04UnCumm,Test04UnCumm[Account]=EARLIER(Test04UnCumm[Account]) && Test04UnCumm[Date] = EARLIER(Test04UnCumm[Date])),Test04UnCumm[Index],,ASC)  

Step 3 : Finally, here is the magical column we are looking for

 

UnCummVal = 
VAR _PrevCummVal = LOOKUPVALUE(Test04UnCumm[CummVal],Test04UnCumm[Account],Test04UnCumm[Account],Test04UnCumm[Date],Test04UnCumm[Date]-1,Test04UnCumm[RankAccount],Test04UnCumm[RankAccount])
RETURN IF(_PrevCummVal=BLANK(),Test04UnCumm[CummVal],Test04UnCumm[CummVal] - _PrevCummVal) 

The output will be as below :

 

image.png

 

Uhhh !! Nice one 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




@PattemManohar, this is it. I already tried that one with the lookupvalue and the index but hadn't got the clue to use a rank. That was the missing link. Thank you so very much. I really appreciate it.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.