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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.