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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.