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

Join 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.

Reply
Anonymous
Not applicable

Effective Forecast and Excess calculation

Hi,
Here's the sample data with calculations done in excel (https://www.dropbox.com/s/4zfdyua1wv75ar6/Sample%20Data.xlsx?dl=0). I'm not exactly sure how to do the same calculations in Power BI.

 

Basically for each stock_month/country/material/batch combination, I need to determine if it's in excess or not. I have a 12-month range forecast data coming in for each stock_month/country/material combination.

 

A stock unit is deemed as excess when it cannot be used before it's expiry date and the quantity available is more than the forecast quantity. 

 

The way I did it in excel: 

1) I sorted the data table by stock_month, material, and expiry date

2) For each stock_month/country/material/batch combination, I summed all the forecast quantity (from forecast data table) with 'month' date field before the expiry date listed for that line

3a) Effective Forecast for the first stock_month/country/material/batch combination is just the forecast quantity
3b) Effective Forecast for everything else: forecast quantity for that line - SUM(all quantites before that one for the same stock_month/country/material) + SUM (all excess quantities before that one for the same stock_month/country/material) ---> If this value is below 0, then list 0, otherwise it's the value

4) Excess calculation = Quantity - Effective forecast

How can I do this in Power BI? (In either query editor or dax)

 

Thank you!

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

You can try Power Query to achieve your goal. Dax may be not suitable, due to you need to judge the upward and downward values in the calculation. 

I think you may refer to blogs as below to get accumulate of your quantities and judge the upward and downward values in Power Query.

For reference:

List accumulate in groups

DAX calculated column to get running sum which resets on particular conditions

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.