Forum Discussion
Use MIN in measure, calculated row wise without aggregation
How to get the MIN of two dates in a Measure function without any aggregation. This can be done using a computed column but the issue is that it is not computed dynamically.
See screenshot:
EndDate: is a measure column coming from End_Calendar table and the slicer.
Expected output: For each row, I want the MIN date of the two columns ColDateEnd & EndDate. As shown MinEndDateCalculatedCol gives me the MIN of the two but it is calculated once when the column is added. I learned Measure is computed dynamically. But Measure works at an aggregation level whereas I want to compute the MIN for each row.
I'm a newbie to DAX.
Any alternatives for computing the MIN for each row dynamically?
Hi rantel ,
How about this:
Measure = VAR _temp = { MIN ( 'Sample Table'[Value3] ), MIN ('Sample Table'[Value4]) } RETURN MINX ( _temp, [Value] )/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
4 Replies
- danextian
Super User
Hi rantel ,
You still have to aggregate. MIN function takes either a column or two expressions but not an expression and anotherr column. Wrap the date column in MIN, MAX or SELECEDVALUE to satisfy its requirement. Your formula should be:
= MIN ( MIN ( 'Sample Table'[ColDateEnd] ), [EndDate] ) - tackytechtom
Most Valuable Professional
Hi rantel ,
How about this:
Measure = VAR _temp = { MIN ( 'Sample Table'[Value3] ), MIN ('Sample Table'[Value4]) } RETURN MINX ( _temp, [Value] )/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/- rantelNew Member
Thanks Tom. This worked. Just had to do a small tweak to remove the MIN function call for the Measure column.
Measure = VAR _temp = { MIN ( 'Sample Table'[Value3] ), 'Sample Table'[Value4] } RETURN MINX ( _temp, [Value] )