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

Removing a decimal from a string when it occurs

I am working with version numbers that are represented by a string of numbers, separated by a few decimals - this can vary from version to version. I only need the first 3 numbers of each version. For most versions this involves 5 characters, but I have a few where the third number is a double digit number (i.e., 11, 12, etc.) which means I need to leave 6 characters as opposed to 5. So, I started off trimming (left) by 6 characters and am looking for some way to remove the trailing demical (.) on the versions where I only need 5 characters. Listed below is my source data before trimming it, after trimming it and what I am looking to achieve. Does anyone know how to do this? 

 

 

Data before trimmingData after trimmingGoal
1.2.11.1.2.31.2.111.2.11
1.2.1.0.1.21.2.1.1.2.1
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @krfaughnan,

Text.BeforeDelimiter([Data before trimming], ".", 2)

 

On the query editor add a new column with the following formula.

 

As you can see in the documentation the first parameter is the text you want to trim, second parameter the character that you want to trim from, and the last parameter is the position of that character in this case is your second.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @krfaughnan,

Text.BeforeDelimiter([Data before trimming], ".", 2)

 

On the query editor add a new column with the following formula.

 

As you can see in the documentation the first parameter is the text you want to trim, second parameter the character that you want to trim from, and the last parameter is the position of that character in this case is your second.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Perfect! Thank you - that worked!!

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.