Forum Discussion
True/False Columns When Data is Binary
I have two questions about logical true/false data types. I am working on updating and optimizing old Power BI models that are large and slow. I am finding as I go through them that we have a lot of columns in the data that are basically binary options, but none of it is presented as true/false. Much of it is yes/no, or Y/N, but sometimes it's active/inactive, etc.
My questions are:
- Is there a performance benefit to changing these columns which are currently stored as text in all these models to logical true/false columns?
- Is there a way to do this other than replacing the values in each one with true and false and then applying the true/false data type?
For example, in the table I'm working on right now, there are four such columns, and that's not at all unusual.
Hi Xaraja ,
Try to use1/0 instead of TRUE/FALSE.String values do not compress as well as integer values. By replacing string values with integer values.
refer:
https://lytix.be/performancetipspowerbi/
Best Regards
Lucien
3 Replies
- truptisCommunity Champion
Hi Xaraja ,
It is advisable to move the flag column calculations on DB level instead of doing them on Power BI. Because it brings load to the report while applying the changes.
Also, it is prefered to Format flag columns as Yes/No value strings.
Refer this article for knowing more about the best practices/optimisation of the report:
https://powerbi.microsoft.com/cs-cz/blog/best-practice-rules-to-improve-your-models-performance/
Hope this helps you. If it does, please hit the thumbs up! Thank you.
Regards,
TruptiS- XarajaHelper III
Hi truptis,
I don't currently have the option to make any changes to the DB level unfortunately. Thanks for the link; I have read that article but didn't realize that "flag columns" was referring to the type of columns I was looking at. So instead of changing these to True/False, it would be best to leave them as Text data type and Yes/No values? I tried googling for more information about flag columns but all I'm finding is information about making new calculated columns to be flag columns.
- v-luwang-msftCommunity Support
Hi Xaraja ,
Try to use1/0 instead of TRUE/FALSE.String values do not compress as well as integer values. By replacing string values with integer values.
refer:
https://lytix.be/performancetipspowerbi/
Best Regards
Lucien