Forum Discussion

ldwf's avatar
ldwf
Helper V
4 years ago
Solved

DAX 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...
  • Anonymous's avatar
    Anonymous
    4 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