Forum Discussion

elfunambolo83's avatar
elfunambolo83
Regular Visitor
3 years ago
Solved

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

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

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

8 Replies

  • Anonymous's avatar
    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)

    • elfunambolo83's avatar
      elfunambolo83
      Regular Visitor

      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's avatar
        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"

  • 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.


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