Forum Discussion
ldwf
Helper V
4 years agoDAX code for measure not working
Hello, I have a PBI star schema model. i'm trying to define a measure in the fact table using a numeric field (health index) that resides in one of the dimension tables and corresponds to the maxi...
- 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
ldwf
Helper V
4 years agoThe 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