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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
dolevh
Helper II
Helper II

Query from Excel to PBI

Hey,

I Just want to add a column to my table but I don't know how to write it on PBI. 

thanks for everything. 

 

help.png

1 ACCEPTED SOLUTION

Hi  @dolevh,

 

Using below M code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjYwUNJRMjLUdSwoAjJMLYyUYnWilUywCMcCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Hours = _t, Month = _t, ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Hours", Int64.Type}, {"ID", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Epic %", each [Hours]/List.Sum(Table.SelectRows(#"Changed Type",(x)=>x[Month]=[Month] and x[ID]=[ID])[Hours])),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Epic %", Percentage.Type}})
in
    #"Changed Type1"

 

 

And you will see:

vkellymsft_0-1630047928317.png

 

 

Check my .pbix file attached.

 

Best Regards,
Kelly

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

View solution in original post

3 REPLIES 3
dolevh
Helper II
Helper II

@Fowmy 

Power Query please

 

Category (%) =P6/SUMIFS(P:P,K:K,K6,M:M,M6)

Hi  @dolevh,

 

Using below M code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjYwUNJRMjLUdSwoAjJMLYyUYnWilUywCMcCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Hours = _t, Month = _t, ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Hours", Int64.Type}, {"ID", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Epic %", each [Hours]/List.Sum(Table.SelectRows(#"Changed Type",(x)=>x[Month]=[Month] and x[ID]=[ID])[Hours])),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Epic %", Percentage.Type}})
in
    #"Changed Type1"

 

 

And you will see:

vkellymsft_0-1630047928317.png

 

 

Check my .pbix file attached.

 

Best Regards,
Kelly

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

Fowmy
Super User
Super User

@dolevh 

Do you need it as Power Query or DAX solution? 


paste your sample data and the expected result from Excel in your reply


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.