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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Impactful Individual
Impactful Individual

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  

freginier
Impactful Individual
Impactful Individual

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 MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.