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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
BigKev
Helper III
Helper III

Maintaining trailling zero in decimal point where applicable

Hi All,

 

I have an issue converting data type from text to decimal point while maintaining the leading zero where applicable.

 

The column on the left is the original data, and the column on the right is after I converted it to the decimal point.

BigKev_0-1712148039923.png

 

As you can see 

  • 5.10 become 5.1
  • 7.10 become 7.1
  • 7.20 become 7.2

 

Because of this, I have a duplicate rank, which is supposed to be different. 

 

How can I keep the trailing zero, where applicable, after converting to a decimal point? And I need the data type as a decimal point.

 

Thanks

1 ACCEPTED SOLUTION
Wilson_
Super User
Super User

BigKev,

 

If you need 5.9 to come before 5.10, then you need to transform your 5.9 to 5.09 (assuming they'll only ever be a maximum of two decimal places) before converting it to a decimal place, then show two decimal places in your column.

 

From the query editor, go back to in your steps to before you added the column, click Add Column > Column From Examples, then work with that until you're satisfied with the transformation. Then you can convert that new column to a number. At this point, click Close & Apply.

 

Wilson__1-1712195093064.png

 

Wilson__0-1712195066636.png

 

If you want to see two decimal places, you can do that from the column tools once the data is loaded.

 

Wilson__3-1712195221959.png

 

Hope that helps!


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)


P.S. Need a more in-depth consultation for your Power BI issue? Feel free to hire me on Upwork or to DM me on here to discuss how we can make your problems disappear. 😄




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Wilson_
Super User
Super User

BigKev,

 

If you need 5.9 to come before 5.10, then you need to transform your 5.9 to 5.09 (assuming they'll only ever be a maximum of two decimal places) before converting it to a decimal place, then show two decimal places in your column.

 

From the query editor, go back to in your steps to before you added the column, click Add Column > Column From Examples, then work with that until you're satisfied with the transformation. Then you can convert that new column to a number. At this point, click Close & Apply.

 

Wilson__1-1712195093064.png

 

Wilson__0-1712195066636.png

 

If you want to see two decimal places, you can do that from the column tools once the data is loaded.

 

Wilson__3-1712195221959.png

 

Hope that helps!


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)


P.S. Need a more in-depth consultation for your Power BI issue? Feel free to hire me on Upwork or to DM me on here to discuss how we can make your problems disappear. 😄




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





MNedix
Super User
Super User

Have you tried formatting the Custom column as text in PowerQuery?



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,
Joe_Barry
Super User
Super User

Hi @BigKev 

 

Is it possible to change numbers like 7.1 to 7.01? This will then keep it's numerical sort

 

Joe

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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