Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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

 

 

 

thanks for your assistance!

  • 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))

2 Replies

  • 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))

    • Anonymous's avatar
      Anonymous
      Not applicable

      thank you!  That was the syntax I needed.