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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.