March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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 statuses for an order is as follows:
New > Wvalid> Valid > Wappr > Appr
If an order has a timestamp for the 'Status Appr Date' then the timestamps for the previous columns CANNOT BE AFTER this date. If they do, the order is considered to be 'reversed'. I would like to track the number of 'reversed' orders
ID | Description | Status New Date | Status Wvalid Date | Status Valid Date | Status Wappr Date | Status Appr Date |
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | ||||
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | |||
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 | 2020-08-11 09:00:17 | 2020-08-18 15:36:22 |
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 | 2020-08-11 09:00:17 | 2020-08-18 15:36:22 |
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 | ||
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 | 2020-08-11 09:00:17 | |
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 | 2020-08-11 09:00:17 | 2020-08-18 15:36:22 |
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 | 2020-08-11 09:00:17 | 2020-08-18 15:36:22 |
1252955 | 100 No climbing deterant fitted near public area. | 2013-12-06 08:12:23 | 2013-12-06 08:13:14 | 2014-04-10 12:34:13 |
Solved! Go to Solution.
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,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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?
Hi @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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
106 | |
98 | |
65 | |
54 |