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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.