Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi All,
Hopefully this is a relatively easy ask, though for whatever reason I haven't been able to find a solution that meets my needs. I have some transportation data I'm working with, but the system feeding the data into my data model does not indicate which stop is the last stop on the shipment. What I need is some sort of indicator that stop X is the last stop for a given shipment; in the example below stop 5 is the last stop for shipment 200001.
Shipment_ID | Stop_Number | Planned_Arrival | Planned_Departure | Actual_Arrival | Actual_Departure |
200001 | 1 | 7/26/22 9:00 | 7/26/22 9:00 | 7/26/22 9:00 | 7/26/22 9:05 |
200001 | 2 | 7/26/22 9:30 | 7/26/22 9:40 | 7/26/22 9:30 | 7/26/22 9:40 |
200001 | 3 | 7/26/22 10:00 | 7/26/22 10:10 | 7/26/22 10:00 | 7/26/22 10:05 |
200001 | 4 | 7/26/22 10:30 | 7/26/22 10:35 | 7/26/22 10:35 | 7/26/22 10:40 |
200001 | 5 | 7/26/22 10:45 | 7/26/22 11:00 | 7/26/22 11:00 |
Ultimately I'm trying to build a report to help identify how often the various freight carriers we use are not supplying the Actual_Departure date/time for the last stop on a shipment, but without some sort of identifier of which stop is the last stop (shipments can have a minimum of 2 or a max of 20 stops) I'm not sure how to even begin filtering for the correct calculation.
If there's a better way to do this without "flagging" the last stop per shipment, I'm open to it! Any help is appreciated!
Solved! Go to Solution.
You can check if the stop number in the current row equals the maximal stop number for that specific shipment.
For example, something like this as a new calculated column:
IsLastStop =
Table1[Stop_Number]
= CALCULATE (
MAX ( Table1[Stop_Number] ),
ALLEXCEPT ( Table1, Table1[Shipment_ID] )
)
You can check if the stop number in the current row equals the maximal stop number for that specific shipment.
For example, something like this as a new calculated column:
IsLastStop =
Table1[Stop_Number]
= CALCULATE (
MAX ( Table1[Stop_Number] ),
ALLEXCEPT ( Table1, Table1[Shipment_ID] )
)
User | Count |
---|---|
145 | |
71 | |
69 | |
53 | |
52 |
User | Count |
---|---|
208 | |
94 | |
64 | |
60 | |
57 |