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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Dax: Calculate difference between 2 values in same column based on date selection

Please assist with Dax syntax for measure to subtract the Med All value for the max date minus Min date for value in same column.  The user will select 2 "As of Dates" for the calculation.  Column name is Med All.

 

16,186 - 16,128 = 58

PRay_1-1620224556653.png

 

PRay_2-1620224678744.png

 

 

PRay_0-1620224472248.png

thanks for your assistance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try measure like

 

Diff =
var _max = maxx(allselected('As on date'), 'As on date'[Date])
var _min = minx(allselected('As on date'), 'As on date'[Date])
return
calculate(sum(pptcount[med all]) , filter('As on date', 'As on date'[Date] =_max)) -calculate(sum(pptcount[med all]) , filter('As on date', 'As on date'[Date] =_min))

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

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try measure like

 

Diff =
var _max = maxx(allselected('As on date'), 'As on date'[Date])
var _min = minx(allselected('As on date'), 'As on date'[Date])
return
calculate(sum(pptcount[med all]) , filter('As on date', 'As on date'[Date] =_max)) -calculate(sum(pptcount[med all]) , filter('As on date', 'As on date'[Date] =_min))

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
Anonymous
Not applicable

thank you!  That was the syntax I needed.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.