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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Aphax1477
Regular Visitor

Calculating stocks depending on best before dates

Hello,

 

I need some help with the following problem:

We have products with different best before dates. I would like to calculate how long the respective stock/best-before date will last and how much stock may need to be disposed of, given the current sales rate. For me, the start time of sales for the following BBDs is the crucial point here that needs to be calculated.

 

In this example here, the sale of the product with the first best before date must be stopped on 16/04, as the best before date has been reached and the sale of the next best before date batch begins.

Does anyone have any ideas on this? Many thanks in advance.

 

Aphax1477_0-1709551517349.png

 

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Aphax1477 I'm unclear what you are asking here. When you say the "sale of the product must be stopped" what does that mean exactly? 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

This means that Today=Bestbeforedate, we can no longer sell this batch of the product.
From now on, we can only sell the next batch of this product.

Hope this helps to explain the problem better.

@Aphax1477 OK, I *get* that much. The question is, what does that actually mean in terms of your report. Is there a particular calculation that you need, like a measure or ???



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I need a calculation of when the sale of the 2nd batch starts? Under the condition that the end of sales of the 1st batch can be either the best-before date or the out of stock date, whichever comes first.


Measure: Start date for sales

Sales Start Batch 1 = Today
Sales Start Batch 2 = ?
(Sales Start Batch 3 = ? ....)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.