Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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?
Solved! Go to Solution.
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/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
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/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
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] )
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] )
Proud to be a Super User!
Thanks for the quick response @danextian - I could not get this working. Since the other solution worked, I stopped exploring this. Thank you.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
96 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |