Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BigESloth
New Member

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. 🙂

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

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.

vzhouwenmsft_0-1727839498603.png

I think the mistake should be here.

vzhouwenmsft_1-1727839548182.png

vzhouwenmsft_2-1727839571702.png

 

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

 

Best Regards,
Wenbin Zhou

 

View solution in original post

2 REPLIES 2
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.

vzhouwenmsft_0-1727839498603.png

I think the mistake should be here.

vzhouwenmsft_1-1727839548182.png

vzhouwenmsft_2-1727839571702.png

 

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

 

Best Regards,
Wenbin Zhou

 

rajendraongole1
Super User
Super User

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.