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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
sasdfasdfsad
Advocate II
Advocate II

Best Practice: Binary True/False vs Integer 1/0 ?

I want to use a flag field for if records have a given status, or are marked for deletion, etc...

I was using an Integer with a 0 for FALSE and 1 for TRUE.  

Then I did a nice SUM on the field to get what I was after.

However, if I add a slicer, showing 0 and 1 is NOT user friendly.

Is there any downside to changing it to a True/False field?

I'd use COUNT instead of SUM to count the TRUE values, but other than that.  Is there any downside?

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@sasdfasdfsad Readability: True/False fields are more intuitive and user-friendly, especially when used in slicers or filters. Users can easily understand the meaning of True/False compared to 0/1.
Data Modeling: True/False fields are explicitly designed for boolean logic, which can make your data model more semantically correct and easier to understand.
DAX Functions: Power BI's DAX language has built-in support for boolean fields, which can simplify your calculations and improve readability.

 

CountOfTrueValues = COUNTROWS(FILTER(Table, Table[FlagField] = TRUE()))




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

parry2k
Super User
Super User

@sasdfasdfsad I don't see any different storing 0/1 or True/False, only thing come in mind is that you cannot use True/False value in the filter page (like visual/page/report level filters) other than that I don't see any difference.

 

Other difference you already point out that you will use count with condition, if you want count of true or false values, although sum is always returning sum of true values.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@sasdfasdfsad also the DAX can be written like this;

 

CountOfTrueValues = COUNTROWS(FILTER(Table, Table[FlagField]))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@sasdfasdfsad I don't see any different storing 0/1 or True/False, only thing come in mind is that you cannot use True/False value in the filter page (like visual/page/report level filters) other than that I don't see any difference.

 

Other difference you already point out that you will use count with condition, if you want count of true or false values, although sum is always returning sum of true values.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Good point about SUM still working even, I didn't process that at all.  Thank you!!

bhanu_gautam
Super User
Super User

@sasdfasdfsad Readability: True/False fields are more intuitive and user-friendly, especially when used in slicers or filters. Users can easily understand the meaning of True/False compared to 0/1.
Data Modeling: True/False fields are explicitly designed for boolean logic, which can make your data model more semantically correct and easier to understand.
DAX Functions: Power BI's DAX language has built-in support for boolean fields, which can simplify your calculations and improve readability.

 

CountOfTrueValues = COUNTROWS(FILTER(Table, Table[FlagField] = TRUE()))




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors