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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

DAX Comparison Operations

Hi all,

 

Can anyone help with the following issue - I'm wanting a card to display 0 if another visual is filtered, else show result of calculation;

 

Satisfaction % =
if(isfiltered(SentimentScore[Sentiment])="Negative",0,
CALCULATE(count('SentimentScore'[MessageID]),'SentimentScore'[Sentiment]<>"Negative")
/count('SentimentScore'[MessageID]))
 
Recieving the 'do not support comparing values of type True/False with values of type text.
 
Thanks,
Rob
 
 
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Modify your measure like below. The return value of ISFILTERED() is True/False, which cannot be compared with "Negative".

Satisfaction % =
IF (
    ISFILTERED ( 'SentimentScore'[Sentiment] )
        && SELECTEDVALUE ( 'SentimentScore'[Sentiment] ) = "Negative",
    0,
    CALCULATE (
        COUNT ( 'SentimentScore'[MessageID] ),
        'SentimentScore'[Sentiment] <> "Negative"
    )
        / COUNT ( 'SentimentScore'[MessageID] )
)

 

Kindly let me know if this helps.

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Modify your measure like below. The return value of ISFILTERED() is True/False, which cannot be compared with "Negative".

Satisfaction % =
IF (
    ISFILTERED ( 'SentimentScore'[Sentiment] )
        && SELECTEDVALUE ( 'SentimentScore'[Sentiment] ) = "Negative",
    0,
    CALCULATE (
        COUNT ( 'SentimentScore'[MessageID] ),
        'SentimentScore'[Sentiment] <> "Negative"
    )
        / COUNT ( 'SentimentScore'[MessageID] )
)

 

Kindly let me know if this helps.

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Replcae your DAX with the following:

Satisfaction % =
if(isfiltered(SentimentScore[Sentiment])="Negative",0,
CALCULATE(count('SentimentScore'[MessageID]), FILTER('SentimentScore', 'SentimentScore'[Sentiment]<>"Negative"))
/count('SentimentScore'[MessageID]))
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.