Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Number of days in random lines

I have a SQL table with a history of vehicle movements. Each line is a movement, with movement code, vehicle code, company of origin and destination, initial and final mileage, initial and final date and the vehicle status in that movement (example: leased, under maintenance, washing, etc.) .
I need to count the number of days that a vehicle takes from status x to another status y, and it may or may not pass through other statuses in that interval with varying number of days.
The table is neither separated nor ordered by vehicle.
Any tips where to start?

2 REPLIES 2
Anonymous
Not applicable

Without seeing a table with the data it's not possible to help you. Sorry.
Fowmy
Super User
Super User

@Anonymous 

Sure we can help you out,

Can you share some sample data and the expected result as data to have a clear understanding of your question?

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.