Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hopefully I can explain this. I'm looking to find two things. First I need a measure that first the first Positive AFTER the first negative, then I need to find how negative did we go before we went positive?
Examples:
In this example - the stock out date is 7/31 (calculated as:
If copy and past needed:First Positive After Stock Out = 8/4
Most Negative = -3
if copy paste needed
| Index | Due Date | Running Total | CheckStatus |
| 70916 | 7/5/2023 | 12 | Positive |
| 70917 | 7/12/2023 | 11 | Positive |
| 70918 | 7/18/2023 | 10 | Positive |
| 70919 | 7/21/2023 | 9 | Positive |
| 70920 | 7/28/2023 | 8 | Positive |
| 70921 | 8/1/2023 | -2 | Negative |
| 70922 | 8/3/2023 | -3 | Negative |
| 70923 | 8/4/2023 | 2 | Positive |
| 70924 | 8/10/2023 | 1 | Positive |
| 70925 | 8/18/2023 | 4 | Positive |
| 70926 | 8/18/2023 | 3 | Positive |
Solved! Go to Solution.
Hi, @DemingPDCA
In this case, you can use a similar approach as the one you used for finding the stock out date.
CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER (
ALL ( 'Inventory Watch' ),
'Inventory Watch'[Due Date] > CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER ( 'Inventory Watch', 'Inventory Watch'[CheckStatus] = "Negative" )
)
&& 'Inventory Watch'[CheckStatus] = "Positive"
)
)
To find the most negative value between the first Negative and the next Positive, you would use a formula like:
CALCULATE (
MIN ( 'Inventory Watch'[Running Total] ),
FILTER (
ALL ( 'Inventory Watch' ),
'Inventory Watch'[Due Date] >= CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER ( 'Inventory Watch', 'Inventory Watch'[CheckStatus] = "Negative" )
)
&& 'Inventory Watch'[Due Date] <= CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER (
ALL ( 'Inventory Watch' ),
'Inventory Watch'[Due Date] > CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER ( 'Inventory Watch', 'Inventory Watch'[CheckStatus] = "Negative" )
)
&& 'Inventory Watch'[CheckStatus] = "Positive"
)
)
)
)
These DAX formulae will help you find the first positive date after the first negative one, and the minimum (most negative) 'Running Total' value between the first negative date and the next positive one.
note: youmight need some adjustment
Proud to be a Super User!
You - have just saved me SO MUCH time and frustration!!! I cannot thank you enough!!!
Happy to help.
Appreciate the kudos. 👍
Proud to be a Super User!
Hi, @DemingPDCA
In this case, you can use a similar approach as the one you used for finding the stock out date.
CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER (
ALL ( 'Inventory Watch' ),
'Inventory Watch'[Due Date] > CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER ( 'Inventory Watch', 'Inventory Watch'[CheckStatus] = "Negative" )
)
&& 'Inventory Watch'[CheckStatus] = "Positive"
)
)
To find the most negative value between the first Negative and the next Positive, you would use a formula like:
CALCULATE (
MIN ( 'Inventory Watch'[Running Total] ),
FILTER (
ALL ( 'Inventory Watch' ),
'Inventory Watch'[Due Date] >= CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER ( 'Inventory Watch', 'Inventory Watch'[CheckStatus] = "Negative" )
)
&& 'Inventory Watch'[Due Date] <= CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER (
ALL ( 'Inventory Watch' ),
'Inventory Watch'[Due Date] > CALCULATE (
MIN ( 'Inventory Watch'[Due Date] ),
FILTER ( 'Inventory Watch', 'Inventory Watch'[CheckStatus] = "Negative" )
)
&& 'Inventory Watch'[CheckStatus] = "Positive"
)
)
)
)
These DAX formulae will help you find the first positive date after the first negative one, and the minimum (most negative) 'Running Total' value between the first negative date and the next positive one.
note: youmight need some adjustment
Proud to be a Super User!
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 27 | |
| 23 | |
| 18 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 65 | |
| 42 | |
| 41 | |
| 39 | |
| 37 |