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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
mb0307
Responsive Resident
Responsive Resident

Excess Stock by date

Hi All,

 

Download Sample Data - Excel 

 

I am trying to do Excess Stock analysis in Power BI  but can't get this work.

 

Please see below for example and Result:

 

DEMAND DATA:

Demand.jpg

 

STOCK DATA:

Stock.jpg

 

RESULT:
Result.jpg

 

Thanks in advance if you can help to achieve above result.

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @mb0307 ,

 

"Total Available Stock Meeting Demand" = CALCULATE(SUM(STOCK[Stock]),FILTER(ALL(STOCK),STOCK[Available Date].[Month]=SELECTEDVALUE(DEMAND[Date of Demand].[Month])&&STOCK[Available Date]>=SELECTEDVALUE(DEMAND[Date of Demand])))

Stock NOT Meeting Demand = CALCULATE(SUM(STOCK[Stock]),FILTER(ALL(STOCK),STOCK[Available Date].[Month]=SELECTEDVALUE(DEMAND[Date of Demand].[Month])&&STOCK[Available Date]<SELECTEDVALUE(DEMAND[Date of Demand])))

Excess Stock = [Stock NOT Meeting Demand]-SUM(DEMAND[Demand])

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @mb0307 ,

 

"Total Available Stock Meeting Demand" = CALCULATE(SUM(STOCK[Stock]),FILTER(ALL(STOCK),STOCK[Available Date].[Month]=SELECTEDVALUE(DEMAND[Date of Demand].[Month])&&STOCK[Available Date]>=SELECTEDVALUE(DEMAND[Date of Demand])))

Stock NOT Meeting Demand = CALCULATE(SUM(STOCK[Stock]),FILTER(ALL(STOCK),STOCK[Available Date].[Month]=SELECTEDVALUE(DEMAND[Date of Demand].[Month])&&STOCK[Available Date]<SELECTEDVALUE(DEMAND[Date of Demand])))

Excess Stock = [Stock NOT Meeting Demand]-SUM(DEMAND[Demand])

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
freginier
Solution Sage
Solution Sage

Can we see your data ? 

if you have this 2 tables you need to merge your tables on product and month/year

mb0307
Responsive Resident
Responsive Resident

Here a link to data:

Data Download - Excel 

 

Please share PBIX if you manage to it in power bi. 

 

Thanks  

See this I create the query, I need more information about business rules to create total's 

https://file.io/jejO1WwQd8to

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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