Reply
Frequent Visitor
Posts: 15
Registered: ‎02-18-2016
Accepted Solution

Dax Calculation Help

[ Edited ]

Can someone help me please write this DAX measure:

Dax Measure.PNG

 

I want the MaxDate measure to return "7/2/2002" (which is the max DOB within the selected range by the slicer) for every single record selected. My DAX measure "MaxDate = CALCULATE(MAX([DOB]))" returns the max date in the whole DOB column.


Accepted Solutions
Super Contributor
Posts: 1,815
Registered: ‎08-11-2015

Re: Dax Calculation Help

MaxDate Measure = CALCULATE(MAX('Table'[DOB]), ALLSELECTED('Table'[DOB]) )

View solution in original post


All Replies
Super Contributor
Posts: 1,815
Registered: ‎08-11-2015

Re: Dax Calculation Help

MaxDate Measure = CALCULATE(MAX('Table'[DOB]), ALLSELECTED('Table'[DOB]) )
Frequent Visitor
Posts: 15
Registered: ‎02-18-2016

Re: Dax Calculation Help

Great! thanks Sean so much. It works exactly the way I want.

Now, I need help with the second problem: when I try to calculate the difference between the Max Date Measure and DOB using both a new Diff Meausre or Diff Calculated Column, I get the following errors:

 

1- Diff Measure = Table[MaxDate]- Table[DOB]
A single value for column 'DOB' in table 'Waitlist' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

 

2- Diff Calculated Column = Table[MaxDate]- Table[DOB]
A circular dependency was detected.

 

Any clue how to get the difference between the Max Date and DOB for each record selected within the range using the slicer ?

Highlighted
Super Contributor
Posts: 1,815
Registered: ‎08-11-2015

Re: Dax Calculation Help

Diff Measure = DATEDIFF ( MIN ( 'Table'[DOB] ), [MaxDate Measure], DAY )