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.
Looking to find the time difference betwee certain items within an order. My data set has a different line for each status of each item of each order. What i am looking to do is create a measeure that calculates the time between certain statuses within each of these unique order / item types. In this case, the time betwee the "confirmed" status and the "allocated" status.
I'm sure its a DATEDIFF function but i am having trouble with the filter context.
Solved! Go to Solution.
Hi @awitt
1.create two tables based on your table
table 1
status_1 = VALUES(Sheet2[status])
status_2 = VALUES(Sheet2[status])Change [status] in this table to [status_2]
selected1 = SELECTEDVALUE(status_1[status_1]) selected2 = SELECTEDVALUE(status_2[status_2]) date1 = CALCULATE(MAX(Sheet2[date]),FILTER(ALLEXCEPT(Sheet2,Sheet2[order number],Sheet2[item]),Sheet2[status]=[selected1])) date2 = CALCULATE(MAX(Sheet2[date]),FILTER(ALLEXCEPT(Sheet2,Sheet2[order number],Sheet2[item]),Sheet2[status]=[selected2])) diff = DATEDIFF([date1],[date2],HOUR) final = IF([date2]=BLANK(),"N/A",[diff]/24)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @awitt
1.create two tables based on your table
table 1
status_1 = VALUES(Sheet2[status])
status_2 = VALUES(Sheet2[status])Change [status] in this table to [status_2]
selected1 = SELECTEDVALUE(status_1[status_1]) selected2 = SELECTEDVALUE(status_2[status_2]) date1 = CALCULATE(MAX(Sheet2[date]),FILTER(ALLEXCEPT(Sheet2,Sheet2[order number],Sheet2[item]),Sheet2[status]=[selected1])) date2 = CALCULATE(MAX(Sheet2[date]),FILTER(ALLEXCEPT(Sheet2,Sheet2[order number],Sheet2[item]),Sheet2[status]=[selected2])) diff = DATEDIFF([date1],[date2],HOUR) final = IF([date2]=BLANK(),"N/A",[diff]/24)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |