Forum Discussion
Status as at date
Hello,
Looking for a bit of help with a measure to populate a line graph.
I have two tables;
FactOrder:
Which lists orders and their ID's with a new record added each time an order changes status e.g.
| OrderID | OrderStatus | OrderStatusDate |
1 | Closed | 18/07/2023 |
1 | Reopen | 12/07/2023 |
1 | Closed | 02/07/2023 |
1 | Open | 29/06/2023 |
2 | Closed | 19/07/2023 |
2 | Reopen | 09/07/2023 |
2 | Closed | 01/07/2023 |
2 | Open | 20/06/2023 |
3 | Open | 21/06/2023 |
4 | Closed | 10/07/2023 |
4 | Open | 01/07/2023 |
5 | Closed | 19/07/2023 |
5 | Reopen | 13/07/2023 |
And DimReportingDate:
This lists Dates which are at the end of a reporting week e.g.
ReportWeekEnd |
20/07/2023 |
20/07/2023 |
06/07/2023 |
29/06/2023 |
22/06/2023 |
15/06/2023 |
I'm looking to use these to populate a line graph which does a distinct count of OrderID that were Open or Reopen at the dates listed in DimReportingDate, however I've been going around in circles.
I was hoping to gain a bit of help or guidance here
an example of what this small subset would look like
2 Replies
- amitchandakSuper User
Nasus_ , First have date table with choice of week ending date
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Power-BI-Turning/ba-p/1187482
https://medium.com/chandakamit/cheat-sheet-any-weekdays-week-start-date-just-one-variable-apart-6b2e6f593958then you can have measure like
calculate(distinctcount(Table[OrderID]), filter(Table, Table[OrderStatus] in {"Open", "Reopen"}))
If this does not help
Can you share sample output in table format? Or a sample pbix after removing sensitive data.- Nasus_Regular Visitor
Hi, Many thanks for getting back to me and apologies for the delay.
Currently I already have a date table as described in my model which has a relationship with the column OrderStatusDate on FactOrder, below is a set of this.DateDay ReportWeekEnd 20/07/2023 20/07/2023 19/07/2023 20/07/2023 18/07/2023 20/07/2023 17/07/2023 20/07/2023 16/07/2023 20/07/2023 15/07/2023 20/07/2023 14/07/2023 20/07/2023 13/07/2023 13/07/2023 12/07/2023 13/07/2023 11/07/2023 13/07/2023 10/07/2023 13/07/2023 09/07/2023 13/07/2023 08/07/2023 13/07/2023 07/07/2023 13/07/2023 06/07/2023 06/07/2023 05/07/2023 06/07/2023 04/07/2023 06/07/2023 03/07/2023 06/07/2023 02/07/2023 06/07/2023 01/07/2023 06/07/2023 30/06/2023 06/07/2023 29/06/2023 29/06/2023 28/06/2023 29/06/2023 27/06/2023 29/06/2023 26/06/2023 29/06/2023 25/06/2023 29/06/2023 24/06/2023 29/06/2023 23/06/2023 29/06/2023 22/06/2023 22/06/2023 21/06/2023 22/06/2023 20/06/2023 22/06/2023 19/06/2023 22/06/2023 18/06/2023 22/06/2023 17/06/2023 22/06/2023 16/06/2023 22/06/2023 15/06/2023 15/06/2023 To give further context here is an example of one order that moves through status's at different dates on the FactOrder Table
OrderID OrderStatus StatusGroupingDate StatusChangedTimeText 80691 Closed 27/08/2022 10:26:35 80691 Open 22/08/2022 20:29:28 80691 Reopen 16/08/2022 11:42:55
So I would need to count this as a value of one for the report weeks where this was at Open or Reopen and any following reporting weeks until its changed to closed, bare in mind orders can be opened and reopened after closure, and can change status' multilple times per reporting week so it needs to take into account the latest one as per that reporting date.
Hopefully that makes sense.