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
Sab
Helper V
Helper V

Error converting percentages

Hello

 

as you see in the screeshot below, when I load these percentage data, the negative ones stay as Text and I don't know why!!! I cannot convert them to number. There is no Chnage Type step in the query and I disabled automatic detection of data types..

 

Sab_0-1620865734855.png

 

Thank you!

 

1 ACCEPTED SOLUTION
watkinnc
Super User
Super User

Your column is not converted to a number type, it's still type any. As long as you have the header row in your data instead of promoting  them to headers. Ideally you'd format the Excel data as a table, and then no work would even be necessary, except to click the Get Data From Table/Range button.

Once you Promote those headers, you can probably use:

Fixed = Table.TransformColumns(PriorStep,  {{"Premium % Change", Number.FromText}})

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

Your column is not converted to a number type, it's still type any. As long as you have the header row in your data instead of promoting  them to headers. Ideally you'd format the Excel data as a table, and then no work would even be necessary, except to click the Get Data From Table/Range button.

Once you Promote those headers, you can probably use:

Fixed = Table.TransformColumns(PriorStep,  {{"Premium % Change", Number.FromText}})

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
Fowmy
Super User
Super User

@Sab 

Try to right-click on the column, Change Type, and select Percentage.

If this doesn't solve your problem, can you share the M code or explain how the column was built? Check source data as well

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Not many steps at all! It just read the excel, navigate to the sheets and then converts positive percentages correctly, but it does not the negative ones!!!

 

I tried to change the '-' and the '%' with regular characters but nothing happened!

Sab_0-1620869177040.png

 

So the correct change type step (which I don't know where is executed!!!), for the first negative value of -0.3% should have been converted to -0.003

 

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.

Top Solution Authors
Top Kudoed Authors