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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
João_Santos
Frequent Visitor

Help with Cumulative subtraction of same Category

Hi,

 

I need a Mesure / Calculated column that subtracts the value of D from column C if the column A are the same "ID",

 

Here is some example data:

 

ABCDDesired Result
450329855710100633857268.640,0029.702,40           38.937,60
450329855710100633857868.640,005.548,40           33.389,20
4503303562101006340576930.252,5094.000,00836.252,50
450333739210100636616939.969,0013.323,00           26.646,00
450338367810100624622518.600,003.100,00           15.500,00
450338367810100626255318.600,002.170,00           13.330,00
450338367810100628030718.600,002.170,00           11.160,00
450338367810100634134018.600,002.170,00             8.990,00


The Excel function used was an IF statement: =IF(A2=A1;E1-D2;C2-D2)

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@João_Santos , try a new column like

 

[C] - sumx(filter(Table, [A] =earlier([A])  && [B] <= earlier([B]) ) , [D] )

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@João_Santos , try a new column like

 

[C] - sumx(filter(Table, [A] =earlier([A])  && [B] <= earlier([B]) ) , [D] )

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s

Hello!!

Exactly what i needed, thanks!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.