This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello,
I am looking for to return the closest date for which a measure that I evaluate is below zero :
I evaluate the evolution of a stock level for different materials and I wish to return the first date on which one of the materials is with a stock value below zero. I tried to use FIRSTDATE and LASTDATE but without success :
ShortageDate = CALCULATE(FIRSTDATE(DateTable[Date]), FILTER(DateTable, [Real Stock] < 0))
With this expression it returns the date on which the aggregation of all the stocks for the different materials are going below zero.
Thanks in advance for your help
Solved! Go to Solution.
Hi, @Anonymous
You need to put the material column as a slicer,and try this measure:
ShortageDate =
MINX (
FILTER (
ALL ( DateTable ),
[Real Stock] < 0
&& [Material] = SELECTEDVALUE ( Material )
),
[Date]
)
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
You need to put the material column as a slicer,and try this measure:
ShortageDate =
MINX (
FILTER (
ALL ( DateTable ),
[Real Stock] < 0
&& [Material] = SELECTEDVALUE ( Material )
),
[Date]
)
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It would be better if i could see how data looks like.
But I would imagine this measure
Proud to be a Super User!
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 29 | |
| 29 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 40 | |
| 33 | |
| 24 | |
| 23 |