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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

COUNTAX with multiple filters not working as expected with 0 and 1 flags.

I have a COUNTAX measure with two filters, but it's not counting my rows that will give me an employee count. I get this error message:

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

This is my measure. The active column has a flag on it with 1 or 0. Power BI sees it as text, so I threw quotes around the 1 and thought that would do it, but it doesn't work. What I get is (blank) in my card. Without quotes around the 1, it won't even display that. 

_M_EmpAdvActiveCountax = 
COUNTAX(
        FILTER(
                AdvisorPerformance,
                AdvisorPerformance[Employee.Employee Type]="Advisor" &&
                AdvisorPerformance[Employee.active]="1"
                ),
        AdvisorPerformance[Employee.rfc_id]
)

StatsForThat_0-1665506239699.png

 

How can I fix this? Is COUNTAX with filters not the best way?

1 ACCEPTED SOLUTION
aj1973
Community Champion
Community Champion

You need to open Power Query and modify the type of the Field Employee.Active to either TEXT or True/False

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

4 REPLIES 4
aj1973
Community Champion
Community Champion

Hi @Anonymous 

Try to use TRUE() function instead of "1", see how it works.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Like this? It didn't work. What else could I try? 

_M_EmpAdvActiveCountax = 
COUNTAX(
        FILTER(
                AdvisorPerformance,              
                AdvisorPerformance[Employee.active]=TRUE()
                ),
        AdvisorPerformance[Employee.rfc_id]
)
aj1973
Community Champion
Community Champion

You need to open Power Query and modify the type of the Field Employee.Active to either TEXT or True/False

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Something strange happened. When I imported my data, my 1s and 0s turned to true and false, but pbi only recognized the true and false as text. So ="True" rather than =TRUE() was the way to do it. Thanks for the help. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.