Forum Discussion

BigESloth's avatar
BigESloth
New Member
1 year ago
Solved

Conditional formatting in Dax Error (comparison T/F to Number)

Hi all,

 

I am making a measure based off a filtered visual on the dashbaord so it gives a grade. I made the measure to get the information from the visual I need help getting the conftional formatting correct becsue I get this error. 

   " MdxScript(Model) (16, 13) Calculation error in measure 'COAParameterRawScore[Measure]: Dax comparison operations do not support comparing values of type True/False with values of type Number. Consider using the VALUE or FORMAT function to convert one of these values. 

 

here are the code slices:

MEASURE =
IF (
    92.5 <[Filter],
    "A",
    IF (
        85 < [Filter] <= 92.5,
        "B",
        IF (
            77.5< [Filter] <= 85,
            "C",
            "D"
        )
    )
)
 
 
Filter =
    VAR __DS0FilterTable =
        FILTER(
            KEEPFILTERS(VALUES('vExternalNOTRManagementList'[ClientName])),
            AND(
                'vExternalNOTRManagementList'[ClientName] IN {"Starbucks"},
                'vExternalNOTRManagementList'[ClientName] IN {"Starbucks"}
            )
        )

    VAR __DS0FilterTable2 =
        FILTER(
            KEEPFILTERS(VALUES('vExternalNOTRManagementList'[DateSent])),
            AND(
                'vExternalNOTRManagementList'[DateSent] >= DATE(2024, 8, 1),
                'vExternalNOTRManagementList'[DateSent] < DATE(2024, 9, 1)
            )
        )

    VAR __DS0FilterTable3 =
        TREATAS({"Pactiv LLC"}, 'vExternalNOTRManagementList'[SupplierName])

VAR __Result = CALCULATE(AVERAGE('COAParameterRawScore'[Total Product Performance]),__DS0FilterTable3,__DS0FilterTable2,__DS0FilterTable)

RETURN
__Result

 

 

Any and all help is appericated. 🙂

  • Hi BigESloth - can check below measure:

    MEASURE =
    IF (
    [Filter] > 92.5,
    "A",
    IF (
    AND([Filter] > 85, [Filter] <= 92.5),
    "B",
    IF (
    AND([Filter] > 77.5, [Filter] <= 85),
    "C",
    "D"
    )
    )
    )

    hope it works, if any please share sample data or pbix file for reference.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi rajendraongole1 ,thanks for the quick reply, I'll add more.

    Hi BigESloth ,

    I've taken a general look at your dax expression for this part, and I don't think there's anything wrong with it.

    I think the mistake should be here.

     

    85 < [Filter] && [Filter] <= 92.5,

     

    Best Regards,
    Wenbin Zhou

     

2 Replies

  • Hi BigESloth - can check below measure:

    MEASURE =
    IF (
    [Filter] > 92.5,
    "A",
    IF (
    AND([Filter] > 85, [Filter] <= 92.5),
    "B",
    IF (
    AND([Filter] > 77.5, [Filter] <= 85),
    "C",
    "D"
    )
    )
    )

    hope it works, if any please share sample data or pbix file for reference.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rajendraongole1 ,thanks for the quick reply, I'll add more.

    Hi BigESloth ,

    I've taken a general look at your dax expression for this part, and I don't think there's anything wrong with it.

    I think the mistake should be here.

     

    85 < [Filter] && [Filter] <= 92.5,

     

    Best Regards,
    Wenbin Zhou