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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
FZOU
Helper IV
Helper IV

Substract two rows

Hello,

 

i have this table with this formula to show result column,it's worked but i need to no calculate the result with red rectangle.

 

EXP.PNG

i didn't find how to make him jump and not substract bike by car and car by bus,the needed result is shown below

 

Exp-True.PNG

Any one can help please ? thank you 🙂

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@FZOU , Create a new column like

New column =
var _ min = MINX(filter(Table, [Index] > earlier([Index] ) , [Category] = earlier([Category])),[Index])
return
[value] -MINX(filter(Table, [Index] =_min , [Category] = earlier([Category])),[value])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@FZOU , Create a new column like

New column =
var _ min = MINX(filter(Table, [Index] > earlier([Index] ) , [Category] = earlier([Category])),[Index])
return
[value] -MINX(filter(Table, [Index] =_min , [Category] = earlier([Category])),[value])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  thank you very much it works, otherwise there is a solution to replace the values (4,8,2) with "-" or blank ? thank you

 

NewColumn.PNG

tex628
Community Champion
Community Champion

Try this:

 

 

Result =
VAR Category_ = Table3[Category]
VAR Index_1 = Table3[Index]
VAR Index_2 = CALCULATE( MIN(Table3[Index]) , Table3[Index] > Index_1 , Table3[Category] = Category_)
Return
Table3[Value] - CALCULATE(Table3[Value] , Table3[Index] = Index_2 )

 

 


Br,
J


Connect on LinkedIn

Hi @tex628 

Result2.PNG  thank you for your response, but i tried your formula and nothing happend it show the same values as the column value

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.