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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power Query - Loop calculating

Hi,

 

I have the following Excel table:

TableTable

 

The column A and B are given data. The column A represents a duration of tasks in decimal format. And the column B represents the end date of the first task in date hour decimal format. What I need is a list of end dates, adding the respective duration to the previous end date as shown in column C. Is it possible in Power Query? I was trying to use List.Accumulate(), but I couldn't use it as well...

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

First, create a index column and this code for a custom column:

let _b = #"Added Index"[B]{0} in
List.Accumulate(
List.Combine(
{{_b},
List.Range(#"Added Index"[A], 0, [Index] + 1)}),
0, (s, c) => s + c)

 

Capture.PNG

 

Change the bold part with your last step name.



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

Proud to be a Super User!



View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

If you are intersted in a DAX solution, then please share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Ashish_Mathur 

 

This tool will run by Excel, so I need to use the Power Query especifically. But thanks!!

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

First, create a index column and this code for a custom column:

let _b = #"Added Index"[B]{0} in
List.Accumulate(
List.Combine(
{{_b},
List.Range(#"Added Index"[A], 0, [Index] + 1)}),
0, (s, c) => s + c)

 

Capture.PNG

 

Change the bold part with your last step name.



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

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 ,

 

Yes! This is exactly what I was trying to figure out. I didn't consider using list.combine, it was what was missing for reasoning.

 

Anyway, I didn't understand what {_b} means, could you please explain?

 

And really thanks for the help!

 

My best regards!!

 

 

 

Hi @Anonymous ,

 

I'm glad it helped.

 

The function List.Combine has a parameter (list of lists). So you need to convert _b to a list.. that's why {_b}.



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

Proud to be a Super User!



Anonymous
Not applicable

Entendi! Obrigado @camargos88 .

 

Abs,

vivran22
Community Champion
Community Champion

Hello @Anonymous 

 

Is this the output you are looking for?

Capture.JPG

 

If yes, then you can use a custom column to add the values of the first two column.

 

If not, then please share more details.

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

Anonymous
Not applicable

Hi @vivran22 

 

This is not the output that I need. In this case, I don't have the list of end dates. I just have the end of the first row (the first task). And the next rows are sequential tasks.

Therefore, the second task will end with the following operation (end date of the first line + duration of the second task).

Anyway, the friend below presented the solution that I needed.

But thanks for the help !!

Best regards!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.