Forum Discussion
DAX code for measure not working
- Anonymous4 years ago
Hi ldwf ,
Here are the steps you can follow:
1. Create measure.
Measure = var _min=MINX(ALLSELECTED('Dim Date Table'),[Date]) var _max=MAXX(ALLSELECTED('Dim Date Table'),[Date]) return CALCULATE( MAX('Dim Health Indexes Table'[Health Index]),FILTER(ALL('Dim Health Indexes Table'), 'Dim Health Indexes Table'[Date]=_max))2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
what did you get now?
could you pls provide the sample fact table and dim table?
What if you select 3/30/22, what's the result you want to get?
The number is inflated by a lot when I use this DAX formula. The model is star schema. The fact table joins to the date table by a date id, and the fact table joins to the other dimension table by the key. The joins are correct, and I am able to write queries joining all three tables. But I want to create a new measure in the fact table using a field in the dimension table (not the date table) and apply it to the maximum date selected in the slicer. Hope this helps explain