Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to substarct the row1 to row2 and then the result will be substracted from row 3 and so on. I am looking for M Query NOT in DAX. Below is the sample data with expected result. Thanks for the help.
Delivery Week | Total Delivery | Expected Result |
31-Dec-23 | 25425 | 25425 |
6-Jan | 92 | 25333 |
13-Jan | 172 | 25161 |
20-Jan | 122 | 25039 |
27-Jan | 112 | 24927 |
3-Feb | 218 | 24709 |
10-Feb | 160 | 24549 |
17-Feb | 154 | 24395 |
24-Feb | 135 | 24260 |
2-Mar | 180 | 24080 |
9-Mar | 184 | 23896 |
16-Mar | 151 | 23745 |
23-Mar | 183 | 23562 |
30-Mar | 182 | 23380 |
6-Apr | 171 | 23209 |
13-Apr | 180 | 23029 |
20-Apr | 140 | 22889 |
27-Apr | 21 | 22868 |
Solved! Go to Solution.
there are so many running total solutions out there...
let
lst = List.Buffer(Table.ToRows(your_table)),
res = Table.FromList(
List.Generate(
() => [i = 0, c = lst{0}, s = c{1}],
(x) => x[i] < List.Count(lst),
(x) => [i = x[i] + 1, c = lst{i}, s = x[s] - c{1}],
(x) => x[c] & {x[s]}
),
(x) => x,
{"week", "delivery", "expected"}
)
in
res
there are so many running total solutions out there...
let
lst = List.Buffer(Table.ToRows(your_table)),
res = Table.FromList(
List.Generate(
() => [i = 0, c = lst{0}, s = c{1}],
(x) => x[i] < List.Count(lst),
(x) => [i = x[i] + 1, c = lst{i}, s = x[s] - c{1}],
(x) => x[c] & {x[s]}
),
(x) => x,
{"week", "delivery", "expected"}
)
in
res
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
8 | |
7 | |
6 | |
6 |