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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
hjg_1234
New Member

Boolean Data Error

I keep getting the error 'The function COUNTX cannot work with values of type Boolean.' but as far as I can tell I'm working with numbers not Boolean data.

 

I have a column called 'Hotel Eligible' that is all 1s or 0s but the data type is set to Whole number.

 

I am just using a basic measure (below) to test it but am getting the above error - does anyone know what might be causing that? Or they best way to get round it? Sorry for basic question - I'm new to this.

 

 

 

Proportion Hotel Eligible = DIVIDE(COUNTX('Air Detail - Leg (Depart)','Air Detail - Leg (Depart)'[Hotel Eligible]>0),COUNTA('Air Detail - Leg (Depart)'[Hotel Eligible])) 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @hjg_1234 

Make sure that your data type for this field is  Whole number, you can replace countx() with a calculation

 

roportion Hotel Eligible = DIVIDE(COUNTROWS(FILTER(ALLSELECTED('Air Detail - Leg (Depart)'),[Hotel Eligible]>0)),COUNTA('Air Detail - Leg (Depart)'[Hotel Eligible]))

 

 

 

vxinruzhumsft_0-1689649586673.png

And if it cannot work, can you provide some sample picture of the error meaasage?

 

Best Regards!

Yolo Zhu

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

2 REPLIES 2
Anonymous
Not applicable

Hi @hjg_1234 

Make sure that your data type for this field is  Whole number, you can replace countx() with a calculation

 

roportion Hotel Eligible = DIVIDE(COUNTROWS(FILTER(ALLSELECTED('Air Detail - Leg (Depart)'),[Hotel Eligible]>0)),COUNTA('Air Detail - Leg (Depart)'[Hotel Eligible]))

 

 

 

vxinruzhumsft_0-1689649586673.png

And if it cannot work, can you provide some sample picture of the error meaasage?

 

Best Regards!

Yolo Zhu

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

Ritaf1983
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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