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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Burhan_Jiru
Frequent Visitor

Power Query transformation

Hi there,

I have to change this into integers and add zeros according to Billion and million.

any help or suggestions are appreciated.

Screenshot (56).png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank you

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

Hi, @Burhan_Jiru 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jbWMzR1UorVATItDcx9wSxdc2M9IyAzFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    power = [M = 6, B = 9],
    f = (t as text) => Number.From(Text.TrimEnd(t, Record.FieldNames(power))) * Number.Power(10, Record.Field(power, Text.End(t, 1))),
    s = Table.TransformColumns(Source, {"Column1", f})
in
    s

 

 

 

 

View solution in original post

5 REPLIES 5
CNENFRNL
Community Champion
Community Champion

let
    Sci = [M = "e6", B = "e9"],
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jbWMzR1UorVATItDcx9wSxdc2M9IwjT0EjP2EQpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),

    Transformed = Table.AddColumn(Source, "Num", each Expression.Evaluate(Text.Select([Column1], {"0".."9","-","."}) & (try Record.Field(Sci, Text.End([Column1],1)) otherwise "")))
in
    Transformed

CNENFRNL_0-1680286114692.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

AlienSx
Super User
Super User

or this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jbWMzR1UorVATItDcx9wSxdc2M9IyAzFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    power = [M = "e6", B = "e9"],
    f = (t as text) => 
        Number.From(
                Text.Remove(t, Record.FieldNames(power)) & Record.Field(power, Text.End(t, 1))
        ),
    s = Table.TransformColumns(Source, {"Column1", f})
in
    s

Hello,

thank you for your help.

 

I am adding a custom column with this m code but getting a table instead of values.

then replace "s" line with 

s = Table.AddColumn(Source, "Amount", each f([Column1]))

This adds a new column "Amount" to table Source. 

AlienSx
Super User
Super User

Hi, @Burhan_Jiru 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jbWMzR1UorVATItDcx9wSxdc2M9IyAzFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    power = [M = 6, B = 9],
    f = (t as text) => Number.From(Text.TrimEnd(t, Record.FieldNames(power))) * Number.Power(10, Record.Field(power, Text.End(t, 1))),
    s = Table.TransformColumns(Source, {"Column1", f})
in
    s

 

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors