Forum Discussion

Jbridge450's avatar
Jbridge450
Regular Visitor
7 years ago
Solved

Measure error

Hi, I am a very new user to Power BI.  I am encountering an error for the measure below.  Can someone provide insight to the potential cause?  If additional information is needed please let me know. ...
  • v-jiascu-msft's avatar
    v-jiascu-msft
    7 years ago

    Hi Jbridge450,

     

    I would suggest you use a calculated column rather than a measure in your scenario. And the formula can be optimized by removing IF.

    Medical Compliance =
    SWITCH (
        TRUE (),
        SEARCH ( "medline", 'FY18 Combined'[Supplier Name], 1, 0 ) > 0, "Compliant",
        SEARCH ( "mckesson", 'FY18 Combined'[Supplier Name], 1, 0 ) > 0, "Compliant",
        AND (
            'FY18 Combined'[Supplier#/Employee ID] = 103447,
            'FY18 Combined'[Source] <> "BOAPCARD"
        ), "Compliant",
        "Non-Compliant"
    )
    

    I have added some data to make this example more clear.

    Measure_error

     

    Best Regards,
    Dale