Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Team,
Please find the following data.here how to find the Out of Stock for consecutive days.Here you can see Item 100 only having OOS for 3 consecutive days.So i need to get the answer 3.
Date | Item | OOS |
10-06-2019 | 100 | 1 |
11-06-2019 | 150 | |
12-06-2019 | 100 | 1 |
13-06-2019 | 100 | 1 |
14-06-2019 | 101 | |
15-06-2019 | 102 | |
16-06-2019 | 100 | |
17-06-2019 | 102 | 1 |
18-06-2019 | 102 | |
19-06-2019 | 102 | 1 |
Solved! Go to Solution.
Hi @Anonymous
You may create a rank column.Then create below measures to get the count.
Rank = RANKX(FILTER(Stock,Stock[Item]=EARLIER(Stock[Item])),Stock[Date],,ASC)
Next_oos = CALCULATE(MAX(Stock[OOS]),FILTER(ALL(Stock),Stock[Item]=MAX(Stock[Item])&&Stock[Rank]=MAX(Stock[Rank])+1))
Last_oos = CALCULATE(MAX(Stock[OOS]),FILTER(ALL(Stock),Stock[Item]=MAX(Stock[Item])&&Stock[Rank]=MAX(Stock[Rank])-1))
Count = COUNTROWS(FILTER(Stock,Stock[OOS]=1&&OR([Next_oos]=1,[Last_oos]=1)))
Regards,
Hi @Anonymous
You may create a rank column.Then create below measures to get the count.
Rank = RANKX(FILTER(Stock,Stock[Item]=EARLIER(Stock[Item])),Stock[Date],,ASC)
Next_oos = CALCULATE(MAX(Stock[OOS]),FILTER(ALL(Stock),Stock[Item]=MAX(Stock[Item])&&Stock[Rank]=MAX(Stock[Rank])+1))
Last_oos = CALCULATE(MAX(Stock[OOS]),FILTER(ALL(Stock),Stock[Item]=MAX(Stock[Item])&&Stock[Rank]=MAX(Stock[Rank])-1))
Count = COUNTROWS(FILTER(Stock,Stock[OOS]=1&&OR([Next_oos]=1,[Last_oos]=1)))
Regards,
Thank you for the reply 🙂 Its really help full.
One more thing,can you suggest me to visualise the following requirement.
I need to showcase how many items are OOS for 1 Day,2 Day 3 day etc
Days | 1D | 2D | 3D |
Item Count | 1 | 2 | 0 |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |