Power Query Loop Calculation

PQDM

New Member
Joined
Feb 6, 2021
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, I am new to Power Query and have an issue with a task which is relatively easy to complete in excel.

I need to get a loop calculation where the next output is dependant on the previous output in two places. Please see below for a brief snapshot.

The Starting point is 100 and no calculation is required. Column B is fixed throughout. Column C values vary between 0 - 15.

The operations is (Previous Answer * Column B) + Previous Answer + Column C

Column A Column B Column C Column D (Operation)
Jan -0.0023 0 (100 * -0.0023) + 100 +0 = 99.77
Feb -0.0023 0 (99.77 * -0.0023) + 99.7 +0 =99.54
Mar -0.0023 7 (99.54 * -0.0023) + 99.54 + 7 = 106.31
Apr -0.0023 0 (106.31 * -0.0023) + 106.31 + 0 =106.07

I came across the following but I am unable to manipulate the code to carry out the multiplication in the first step.


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


Any help would be greatly appreciated!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top