Forum Discussion
digitalpresto
5 years agoFrequent Visitor
Track reversed orders from timestamp data
Hi guys, I have the following data. Basically, for each order id, the system records timestamps for each of the status columns. The sample data below if only for ONE ORDER ID. The sequence of statuse...
- 5 years ago
Hi digitalpresto ,
Try the following formula:
Measure = var t = MAX('Table'[Status Appr Date]) return CALCULATE( DISTINCTCOUNT('Table'[ID]), FILTER( 'Table', 'Table'[Status Appr Date] <> BLANK() && ( 'Table'[Status New Date] > t || 'Table'[Status Wvalid Date] > t || 'Table'[Status Valid Date] > t || 'Table'[Status Wappr Date] > t ) ) )Measure 2 = IF( ISFILTERED('Table'[ID]), [Measure], SUMX( ALLSELECTED('Table'[ID]), [Measure] ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
digitalpresto
5 years agoFrequent Visitor
Thanks v-kkf-msft , yes that marks the Reversed orders correctly, buy since the table can have many rows per order, should we put it to a Summary table (using the SUMMARIZE function), also how do we get the latest/current order status per order?
v-kkf-msft
Community Support
5 years agoHi digitalpresto ,
Try the following formula:
Status =
var Tab =
FILTER(
UNION(
SELECTCOLUMNS('Table', "ID", [ID], "Date", [Status New Date], "Status", "New"),
SELECTCOLUMNS('Table', "ID", [ID], "Date", [Status Wvalid Date], "Status", "Wvalid"),
SELECTCOLUMNS('Table', "ID", [ID], "Date", [Status Valid Date], "Status", "Valid"),
SELECTCOLUMNS('Table', "ID", [ID], "Date", [Status Wappr Date], "Status", "Wappr"),
SELECTCOLUMNS('Table', "ID", [ID], "Date", [Status Appr Date], "Status", "Appr")
),
[Date] <> BLANK()
)
var M_Date = MAXX(Tab, [Date])
return
MAXX(
FILTER(Tab, [Date] = M_Date),
[Status]
)
Best Regards,
Winniz