Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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]))
Solved! Go to Solution.
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]))
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.
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]))
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.
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
User | Count |
---|---|
70 | |
70 | |
34 | |
23 | |
22 |
User | Count |
---|---|
96 | |
94 | |
50 | |
42 | |
40 |