Forum Discussion

Guido_Beulen's avatar
Guido_Beulen
Helper I
1 year ago
Solved

Measure in SWITCH function suddenly ignores Date context: outside of switch it works. Why is this?

Hi all,    I have a measure that calculates the latest score for a variable (expressed as a percentage) based on the last available date that has data, looking like: 2.8.2. Latest Score = CALCULA...
  • v-priyankata's avatar
    v-priyankata
    1 year ago

    Hi Guido_Beulen 

    Thank you for reaching out to the Microsoft Fabric Forum Community.

    Elena_Kalina Thanks for your inputs.
    Guido_Beulen  - please try below DAX, it may helps you, 


    Most Recent Score =
    SWITCH(
    TRUE(),
    '1 Kwaliteit'[Koppelcode KPI] = "2.8.2.",
    FORMAT(
    CALCULATE(
    [Gemiddelde beschikbaarheid],
    KEEPFILTERS('0 DIM Datum'),
    FILTER(
    '1 2 Maas koffie details',
    '1 2 Maas koffie details'[Datum] =
    CALCULATE(
    MAX('1 2 Maas koffie details'[Datum]),
    KEEPFILTERS('0 DIM Datum')
    )
    )
    ),
    "00.0%"
    ),
    BLANK()
    )




     
    If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
    Thank you