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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Difference between two values in the came column.

Hi there.

 

I am fairly new to PowerBI and can't seem to get this right.

 

I want to get the difference between two values in the same column and that will show in a new column.

 

See data table below

YearProjected No. of SwimmersDifference
2021335196.8 
2026354965.5+19,768.7
2031370396.1 
2036383843.7 
2041394566.4 
2046403489.4 
2051412977.8 

 

What would be the DAX for this?

1 ACCEPTED SOLUTION

@Anonymous 

sry, typo error in the DAX. pls change minx to maxx

Column =
var last=MAXX(FILTER('Maintain Participation','Maintain Participation'[Projected No. of Swimmers]<EARLIER('Maintain Participation'[Projected No. of Swimmers])),'Maintain Participation'[Projected No. of Swimmers])
return if(ISBLANK(last),blank(),'Maintain Participation'[Projected No. of Swimmers]-last)




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

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@Anonymous 

pls try this

 

Column = 
var last=minx(FILTER('Table (3)','Table (3)'[Projected No. of Swimmers]<EARLIER('Table (3)'[Projected No. of Swimmers])),'Table (3)'[Projected No. of Swimmers])
return 'Table (3)'[Projected No. of Swimmers]-last

 

1.PNG

if you want the blank for first row. try this

Column = 
var last=minx(FILTER('Table (3)','Table (3)'[Projected No. of Swimmers]<EARLIER('Table (3)'[Projected No. of Swimmers])),'Table (3)'[Projected No. of Swimmers])
return if(ISBLANK(last),blank(),'Table (3)'[Projected No. of Swimmers]-last)




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

Proud to be a Super User!




Anonymous
Not applicable

Hi there.

 

Thank you for your reply.

 

It doesn't seem to be working for me as I am getting a message that "The end of the input was reached".

 

The table name is Maintain Participation if you could try again using that as the name of the table?

@Anonymous 

pls see the attachment below





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

Proud to be a Super User!




Anonymous
Not applicable

Hi @ryan_mayu 

 

That worked thank you, however it is getting the difference between 2021 and the other years and adding them on top of each other. I just want the difference between each of the years (i.e. 2026-2021, 2031-2026 etc.) I have completed more of the data below if it makes more sense. Sorry if i wasn't clear originally.

 

See data table below

YearProjected No. of SwimmersDifference
2021335196.8 
2026354965.5+19,768.7
2031370396.1+15,430.6
2036383843.7+13,447.6
2041394566.4 
2046403489.4 
2051412977.8 

@Anonymous 

sry, typo error in the DAX. pls change minx to maxx

Column =
var last=MAXX(FILTER('Maintain Participation','Maintain Participation'[Projected No. of Swimmers]<EARLIER('Maintain Participation'[Projected No. of Swimmers])),'Maintain Participation'[Projected No. of Swimmers])
return if(ISBLANK(last),blank(),'Maintain Participation'[Projected No. of Swimmers]-last)




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

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.