The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I'm currently working with a dataset of bus stops. The data doesn't indicate which specific trip each one belongs to, but it does indicate the license plate of the bus in question, which is my only bet for sorting them out (which I do need to do as part of the job). The problem is these being buses they of course show up multiple times during each day because they aren't doing a single trip, they do a few.
Their data is clustered by trips and as far as I could tell the same bus doesn't have its trips stored next to one another, so I thought of doing it this way: I make a new column with an If statement that checks the cell just before it. If it's the same plate then copy the last value used. If it's different then add 1 to the same value
Something like this
Route | Description | PLATE | Direction | Stop | Timestamp | People in | People out | NEW COLUMN |
123 | xxx | 888 | 1-2 | 1 | 07:10 | x | x | 1 |
123 | xxx | 888 | 1-2 | 2 | 07:20 | x | x | 1 |
123 | xxx | 888 | 1-2 | 3 | 07:30 | x | x | 1 |
123 | xxx | 777 | 1-2 | 1 | 07:10 | x | x | 2 |
123 | xxx | 777 | 1-2 | 2 | 07:20 | x | x | 2 |
123 | xxx | 888 | 2-1 | 1 | 14:10 | x | x | 3 |
123 | xxx | 888 | 2-1 | 2 | 14:15 | x | x | 3 |
123 | xxx | 888 | 2-1 | 3 | 14:20 | x | x | 3 |
123 | xxx | 888 | 2-1 | 4 | 14:30 | x | x | 3 |
That way I can then merge the new column with the plate and I would be able to know for certain which data belongs to which specific trip
That's the general idea I have but I don't know what the syntax would have to be or even if it is possible at all
Hi @NotMe ,
Don't seem to understand your requirements, can you explain the relationship between the PLATE, DIRECTION and ROUTE fields and the desired screenshot of the results?
Looking forward to your reply.
Best Regards,
Henry
Plate is the license plate for the bus.
Direction is which way the bus is going. Either from point a A to point B or from point B to point A. There are busses that do multiple trips of each direction which is why I can't just use that so sepparate them.
Route you can ignore since I'm only working with the data from one specific route, meaning it's the same in every entry. Same with Description.
Also another caveat is that the busses don't all make the same stops each trip. They change depending on where people need to board or get off. They are also string data with no clear indication as to the order they're in. There is a timestamp on each entry though that I just realized I accidentally left out in the table earlier.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
80 | |
75 | |
52 | |
50 |
User | Count |
---|---|
133 | |
124 | |
78 | |
64 | |
61 |