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
uthall
Helper II
Helper II

Burndown Column

Hello,

I have a column (A) in a table that has numbers.

I want a new column (B) that is the result of the total sum of column A minus the row value for column A

 

AB
3107
4106
2108
5105
7103
8921
110 

 

Can someone help me do this in powerquery?

2 ACCEPTED SOLUTIONS
Jimmy801
Community Champion
Community Champion

Hello @uthall 

 

add a custom column with this formula. You have to replace the PreviousStep with the name of your previous step

List.Sum(YourPreviousStep[A])-[A]

Here the complete code to copy into the advanced editor

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlaK1YlWMgGTRmDSFEyag0kLS6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t]),
    YourPreviousStep = Table.TransformColumnTypes(Source,{{"A", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(YourPreviousStep, "B", each List.Sum(YourPreviousStep[A])-[A], type number)
in
    #"Added Custom"

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

Anonymous
Not applicable

@uthall 

Basically you can just add a custom column on top of the previous step (underlined) using the following code:

V-pazhen-msft_0-1615187375952.png

 

Result:

V-pazhen-msft_2-1615187440721.png


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@uthall 

Basically you can just add a custom column on top of the previous step (underlined) using the following code:

V-pazhen-msft_0-1615187375952.png

 

Result:

V-pazhen-msft_2-1615187440721.png


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

 

Jimmy801
Community Champion
Community Champion

Hello @uthall 

 

add a custom column with this formula. You have to replace the PreviousStep with the name of your previous step

List.Sum(YourPreviousStep[A])-[A]

Here the complete code to copy into the advanced editor

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlaK1YlWMgGTRmDSFEyag0kLS6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t]),
    YourPreviousStep = Table.TransformColumnTypes(Source,{{"A", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(YourPreviousStep, "B", each List.Sum(YourPreviousStep[A])-[A], type number)
in
    #"Added Custom"

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Thnaks for this.

 

It seems awfully complicated tho, isnt there a simpler way of doing this using a column and powerquery?

Jimmy801
Community Champion
Community Champion

Hello @uthall 

 

adding a custom column and putting my first code is awfully complicated? It's the most basic and easiest thing to do in power query. The second code is only to show a whole example if somebody would like to see it working as a whole, without having a dataset ready

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

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.