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
Periksson
Frequent Visitor

How to change column from decimal to percentages?

I have a column that is shown as a percentage but it display is a decimal type. I want to change it to percentages and when I do it adds two zeroes on end. I need to format the whole column first and add two decimal points on the beginning so when I change it to a percentage type it displays correctly. How do I do that? Don't judge, I'm new to Power BI.

1 ACCEPTED SOLUTION

Right,

 

You could create a custom column in power query and use this code

 

"0." & Text.Replace([Column],",","")

This new column will make your data look like 0.2673 as an example.

The original column first need to be a text data type and you might have to change the delimiter in the code 0.0 -> 0,0 as it depends what regional settings you're using.

Then change the datatype to decimal and than you can follow what @Mariusz provided and it should work

 

 

View solution in original post

6 REPLIES 6
Mariusz
Community Champion
Community Champion

Hi @Periksson,

 

Please follow the steps below
1. Go to Modeling Ribon 
2. Select your table
3. Select your column 
4. Select Percentage 
5. Adjust 0 to 2 decimal places

image.png

 

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Gordonlilj
Solution Sage
Solution Sage

Hi,

 

Could you provide an example on how your data looks currently?

Ok, so I have, e.g. :
26,73
99,3

86,91

97,71

They are all in decimal display and I want to display them in percentage as follows:
26,73%

99,3%

86,91%

97,71%

Right,

 

You could create a custom column in power query and use this code

 

"0." & Text.Replace([Column],",","")

This new column will make your data look like 0.2673 as an example.

The original column first need to be a text data type and you might have to change the delimiter in the code 0.0 -> 0,0 as it depends what regional settings you're using.

Then change the datatype to decimal and than you can follow what @Mariusz provided and it should work

 

 

I forgot to mention, I have negative percentages also.
It's a margin percentage column. Any idea if I can incorporate

an if statement for negative cells?

I get errors when I want to close and apply the query editor because

negative cells have this data now:

 

0.-6321 for -63.21 e.g.

Hi,

 

Sorry, i don't have a lot of time so excuse the less elegant solution.

To make it easy i would add another simple custom column BEFORE creating the one in the previous post.

 

Text.Replace([Column],"-","")

This removes the negative/minus symbol (we will add it back in the next custom column)

 

After this change the column i provided in the previous post to this. (Make sure this column is created after the one right above)

if Text.Contains([Column],"-") 

then "-0." & Text.Replace([CustomColumn],",","")

else "0." & Text.Replace([Column],",","")

Replace [Column] with your original data column and [CustomColumn] with the simple custom column.

Then change it to decimal and then do the same procedure to changing it to percentage.

 

If you have any further problems just ask but it might be some time before i'm able to answer

 

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.