Forum Discussion

martti's avatar
martti
Icon for Helper I rankHelper I
6 years ago
Solved

Measure to calculate only for certain non-numeric values

I have a measure that calculates a result from multiple different measures for different employees, e.g. Measure0 = ( [Measure1] + [Measure2] ) / 2 + [Measure3] My intent is for Measure3...
  • MFelix's avatar
    6 years ago

    Hi martti ,

     

    When using measures you need to be aware that you cannot reference tables/column directly and you need to use aggregators in your case if you use the MAX function for the if statment that should work.

     

    Measure0 =
     ( [Measure1] + [Measure2] ) / 2
        + IF ( MAX ( Tbl_employees[Group] ) = "Group1"; [Measure3]; 0 )

     

    You can also try this variant of the calculation should work in the same way:

     

    Measure0 =
    ( [Measure1] + [Measure2] ) / 2
        + CALCULATE (
            [Measure3];
            FILTER (
                 Tbl_employees;
                Tbl_employees[Group] ="Group1"
            )
        )

     

    Regards,

    MFelix