cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mcflurry
Frequent Visitor

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.

View solution in original post

selimovd
Community Champion
Community Champion

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.

selimovd
Community Champion
Community Champion

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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors