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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
elfunambolo83
Regular Visitor

Remove last digits

Hello,

I want to remove last 15 digits from the right. I tried to use Split column with By Positions fuction but I'm not sute how to use it.

 

Thanks for support

 

Regards,

Giovanni

 

elfunambolo83_0-1672744761505.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

please write the column name like this [#"All: Net Profit"]

View solution in original post

8 REPLIES 8
Mahesh0016
Super User
Super User

@elfunambolo83 
>> First change data type decimal to text >> create new column >> Using Text.Range function in M Code >> then change new column datatype text to decimal >> get your output.
Mahesh0016_0-1672923867173.png


* If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

Anonymous
Not applicable

Hi,

 

We can customize the digit option for fractional values, but I see that the value you have is not fractional. Therefore, the most practical way to get rid of 15 value has 0's is to create an add custom column step where you will divide.

You can insert a new step and create addcolumn like these example down below.

 

= Table.AddColumn(#"Changed Type", "Custom", each [Obj_Id]/1000000000000000)

 

Best regards,

Ezgi Naz Aslankara

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

= Table.AddColumn(#"Changed Type", "Custom", each [Obj_Id]/1000000000000000)

I need to do it for several columns. When I create the second one the first one disappear form the table.

How can I proceed?

 

Thanks

Giovanni

Anonymous
Not applicable

I have created a sample script so you can review the steps I did. You can paste it into the Power Query advanced editor and review the steps I made.


let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRABUo6GEIGFkZYRJVidbDqNiJsoFJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [num1 = _t, num2 = _t, num3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"num1", type number}, {"num2", type number}, {"num3", type number}}),
Custom1 = Table.AddColumn(#"Changed Type", "Custom", each [num1]/1000000000000000),
Custom2 = Table.AddColumn(Custom1, "Custom2", each [num2]/1000000000000000),
Custom3 = Table.AddColumn(Custom2, "Custom3", each [num3]/1000000000000000),
#"Removed Columns" = Table.RemoveColumns(Custom3,{"num1", "num2", "num3"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "num1"}, {"Custom2", "num2"}, {"Custom3", "num3"}})
in
#"Renamed Columns"

Instead of num1,num2 etc.. I need to replace with my columns name?

Anonymous
Not applicable

EzgiAslankara_0-1672813534789.png

1) create an empty query.
2) Paste the script I wrote in the advanced editor.
3) Review after Custom 1 step

Then reflect the steps I created in your own query by changing the num1 names.

I replced num1 with my column name but I receive an error syntax

 

elfunambolo83_0-1672839688779.png

 

Anonymous
Not applicable

please write the column name like this [#"All: Net Profit"]

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors