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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mcflurry
Helper I
Helper I

Card fields count with 2 column filters, only 1 works

I'm trying to count rows from a text column with 2 filters that check another 2 int columns with values that are not 0, but it fails.   

 

MSErrorsT = COUNTROWS(FILTER('datafsa list_sessions','datafsa list_sessions'[# Errors] <> "0" && 'datafsa list_sessions'[# Warnings] <> "0"))


MdxScript(Model) (5, 84) Calculation error in measure 'datafsa list_sessions'[MSErrorsT]: DAX comparison operations do not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

I've tried to do it with cards, but if I place 2 filters in the same card, only one works.

If i place the filters separately, it works, but when i add the other one it only applies the first one.

 

Isn't it possible to apply 2 column filters in the same card?

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @mcflurry 

According to your description, I can roughly understand your requirement, it seems that you want to get the sum value of the count of the errors and warnings, right?

If so, I think defining the variables in the measure can help, you can try to modify the measure like this:

MSErrorsT =
Var _Errors=
CALCULATE(
    COUNTROWS( 'datafsa list_sessions' ),
    FILTER(
        'datafsa list_sessions',
        'datafsa list_sessions'[# Errors] <> 0
    )
)
Var _Warnings=
CALCULATE(
    COUNTROWS( 'datafsa list_sessions' ),
    FILTER(
        'datafsa list_sessions',
        'datafsa list_sessions'[# Warnings] <> 0
    )
)
RETURN
_Errors+_Warnings

And you can check if you can get what you want.

 

If not, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-robertq-msft
Community Support
Community Support

Hi, @mcflurry 

According to your description, I can roughly understand your requirement, it seems that you want to get the sum value of the count of the errors and warnings, right?

If so, I think defining the variables in the measure can help, you can try to modify the measure like this:

MSErrorsT =
Var _Errors=
CALCULATE(
    COUNTROWS( 'datafsa list_sessions' ),
    FILTER(
        'datafsa list_sessions',
        'datafsa list_sessions'[# Errors] <> 0
    )
)
Var _Warnings=
CALCULATE(
    COUNTROWS( 'datafsa list_sessions' ),
    FILTER(
        'datafsa list_sessions',
        'datafsa list_sessions'[# Warnings] <> 0
    )
)
RETURN
_Errors+_Warnings

And you can check if you can get what you want.

 

If not, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

selimovd
Super User
Super User

Hey @mcflurry ,

 

maybe try to filter for numbers (<> 0 ) and not string (<> "0"):

MSErrorsT = COUNTROWS(FILTER('datafsa list_sessions','datafsa list_sessions'[# Errors] <> 0 && 'datafsa list_sessions'[# Warnings] <> 0))

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hey @selimovd ,

 

It does exactly the same as with card filters.

First filter result is 8, and second one is 260, it should be 268.

But result is 8.

Hey @mcflurry ,

 

but you don't get an error anymore?

 

I think I was too focuses on the error and not on the measure 😉.

Try the following measure:

MSErrorsT =
CALCULATE(
    COUNTROWS( 'datafsa list_sessions' ),
    FILTER(
        'datafsa list_sessions',
        'datafsa list_sessions'[# Errors] <> 0 && 'datafsa list_sessions'[# Warnings] <> 0
    )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hey @selimovd ,

Yep, sorry, without the quotes it worked.

But it still shows just the alerts, it doesn't sum the warnings. Result is still 8.

 

It works if i create 3 measures.

1 for warnings, result=260

1 for errors, result=8

1 for total error+warnings = 268

 

Isn't that possible with 1 single measure?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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