Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 33 | |
| 32 | |
| 31 |