Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I'm trying to calculate inventory usage dates based on the demand and expiry.
This allows us to show what inventory will go to waste based on current demand (allowing time to push sales deals or warn finance.)
This works fine in Excel, but I'm struggling to move it to Power Query because I need to reference the cell above. The usual index-merge technique will not work here as the row needs to be calculated based on the calculation of the previous row.
If I were to write this in VBA i would loop through each row, holding the previous row 'stockcompletiondate' in a variable.
Is this functionality available in Power Query? Is there another workaround I should explore?
Excel mock-up below; everything links back to 'stockcompletiondate'
(data changed between screenshots to show more examples)
Edit:
Table of sample data used in the above example.
Site | Product | QTY | SLED | SameSiteAndSku |
1 | A | 100 | 12/05/2024 | FALSE |
1 | A | 53 | 17/05/2024 | TRUE |
1 | A | 80 | 21/05/2024 | TRUE |
1 | b | 1000 | 25/05/2024 | FALSE |
1 | b | 40 | 22/06/2024 | TRUE |
Use List.Accumulate.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Sample data added.
List.Accumulate looks very promising.
I'm unsure how I would work with the multiple columns; I thought that lists are single column.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |