cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PRay
Frequent Visitor

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 IV
Super User IV

@PRay , 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))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
amitchandak
Super User IV
Super User IV

@PRay , 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))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

PRay
Frequent Visitor

thank you!  That was the syntax I needed.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors