Forum Discussion

swathrddy's avatar
swathrddy
Helper I
2 years ago
Solved

Calculated Measure

KPI No 
ValueDate
2.1.1 ActualYes Jun-24
2.1.1 TargetYesJun-24
write a calculated measure to return TEXT from Column value for KPI no = 2.1.1 Actual and date = Jun-24
 

Wrote this, but is giving only if the Value ie "YES"

CALCULATE(
    MIN('Data File for PB'[Value]),
    'Data File for PB'[KPI No] IN { "2.1.1 Actual" },
    'Data File for PB'[Date] >= "1/06/2024"
)

 

I would like to return the exact text for the condition. 

Appreciate your help.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi swathrddy ,

    Based on the information you provided, it looks like the data type of this column is date:

    But you used this in DAX:

    >= "1/06/2024"

    This is equivalent to comparing dates and text, which is incorrect. Please modify it to the following DAX:

    Measure = 
    CALCULATE(
        MIN('Data File for PB'[Value]),
        'Data File for PB'[KPI No] IN { "2.1.1 Actual" },
        'Data File for PB'[Date] >= DATE(2024, 6, 1)
    )

     


    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • swathrddy , Try using below DAX

    DAX
    Measure =
    CALCULATE(
    SELECTEDVALUE('Data File for PB'[Value]),
    'Data File for PB'[KPI No] = "2.1.1 Actual",
    'Data File for PB'[Date] = "Jun-24"
    )

  • Not returning any value 😞

    I have the following target types, in one single table.

    Trying to add headline numbers for current month "Yes". Calculated measure should pull the text YES / NO for current month from Values column.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi swathrddy ,

    Based on the information you provided, it looks like the data type of this column is date:

    But you used this in DAX:

    >= "1/06/2024"

    This is equivalent to comparing dates and text, which is incorrect. Please modify it to the following DAX:

    Measure = 
    CALCULATE(
        MIN('Data File for PB'[Value]),
        'Data File for PB'[KPI No] IN { "2.1.1 Actual" },
        'Data File for PB'[Date] >= DATE(2024, 6, 1)
    )

     


    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.