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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shelley
Continued Contributor
Continued Contributor

How do I Format flag columns as Yes/No value strings?

I use Flag columns all the time with 1 and 0 (1=Yes and 0=No). In this helpful blog post https://powerbi.microsoft.com/en-us/blog/best-practice-rules-to-improve-your-models-performance/ one of the best practices in the formatting section says: Format flag columns as Yes/No value strings. 

How exactly do I do this? I see a True/false option under Data type, but I do not see Yes/No here or in the Format drop-down.

 
Screenshot 2021-02-24 130515.png

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Shelley 

What that article means is have a column of strings (Data Type : Text) and use either "Yes" or "No".

You'll need to amend your flag to output the text "Yes" or "No" rather than 1 or 0.

Creating a column containing "Yes" or "No" will automatically make it a Text (String) data type.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

5 REPLIES 5
PhilipTreacy
Super User
Super User

Hi @Shelley 

What that article means is have a column of strings (Data Type : Text) and use either "Yes" or "No".

You'll need to amend your flag to output the text "Yes" or "No" rather than 1 or 0.

Creating a column containing "Yes" or "No" will automatically make it a Text (String) data type.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Shelley
Continued Contributor
Continued Contributor

Thanks, @PhilipTreacy  Traditionally, we've always been taught integers process better and faster than text. Is this no longer the case with Yes/No in Power BI?

 

Hi @Shelley 

Actually I'm with you. I think on re-reading that article I have mis-understood what they meant.  It doesn't explicitly say that flag columns should be integer but that makes sense for the reason you state.  I think they mean that you should use a custom format to display 1 and 0 and Yes and No.

In which case you can do this by using this Custom Format String on your Whole Number Flag column.

"Yes"; ;"No";

flagformat.png

 

Sorry for the confusion.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


ChrisMendoza
Resident Rockstar
Resident Rockstar

My assumption is the author meant True/false however you should also respond to the blog post with your question.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Glad you posted in the original blog post. I hope the author expands on this.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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