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
StuartSmith
Power Participant
Power Participant

Convert "Percentage" Data type to "Text" Data Type, but keep full format

I have a column in my data set of "Percentage" type and displays values as "75.00%", etc. but I need to convert this column to a "Text" data type, but retain the format of "75.00%", etc. but when I use the "Data Type" option and change to "Text" the formatting is lost and "70.00%" is displayed like "0.7".  

 

How can I convert to text and keep existing format or create a new column that will convert to text, but keep the original format?

10 REPLIES 10
PhilipTreacy
Super User
Super User

Hi @StuartSmith 

Isn't this the same question you asked here

Re: Mixed Text and Percentage column. - Microsoft Power BI Community

Please check my answer there that solves the issue using Custom Format Strings

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!


Tahreem24
Super User
Super User

@StuartSmith ,

Create the Calculated Column with the help of FORMAT:

% Text = FORMAT(B[Percentage],"Percent")
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Can we do this at transformation by replacing the origial column, instead of creating a new column? As I already have a lot of columns in my table.

@Anonymous you can do that in Power Query.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Thanks, I had been trying that, but didnt have much success, but that may have been because I was also then trying to replace some values in the column with text strings such as if the value in a cell was "-1.00%", replace with "Not Disclosed".  How can I improve you code so that it would replace values of "-1.00%" with "Not Discolsed" and "-2.00%" with "N/A"? 

 

Thanks in advance

 

 

2021-02-08_17-37-07.png

You can futher enhance your code by creating another column like below:

Column 2 = IF(Table[% Text] ="-1.00%", "Not Disclosed", IF(Table[% Text] = "-2.00%", "NA", Table [% Text])) 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Thanks Tahreem, that worked.  I guess there is no way to get this working with 1 calculated column and not the 2 calculated columns.

@StuartSmith 

You don't need to ceate another column.  Just make the column Decimal and apply Custom Formatting to the column as I described in your other question 🙂

Re: Mixed Text and Percentage column. - Microsoft Power BI Community

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!


Hi @StuartSmith,

 

I'm not clear abbout 'working with 1 calculated column and not the 2 calculated columns', could you provide expected output?

 

Best Regards,

Link

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.