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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chemmario
Frequent Visitor

Choose minimum date and maximum date for every ID

Hi guys, I'm working with a table like the following: 

 

Start DateVehicle NrUser Name 
01 01 2020001Max
05 02 2020 (he renewed his contract)001Max
03 03 2020 (which is the End date for Max using vehicle 001) 001 Kim
02 01 2020002Max
05 05 2020002Jana 
05 06 2020001 Max
05 10 2020001 Marc 

 

 

I need to create a table that shows how long the user used the vehicle: 

UserVehicle NrStart dateEnd date 
Max 00101 01 2020   03 03 2020
Kim 00103 03 2020  05 06 2020 
Max002 02 01 2020  05 05 2020
Max001 05 06 2020  05 10 2020

 

 

It's very complex to find a solution for that, I would be thankful for anything! Thank you!

3 REPLIES 3
amitchandak
Super User
Super User

@chemmario , is first and last, is not for the same user, same Vehicle ?

How do we decide where to stop max and start min again

The problem is that a user can rent that car a second time and there will be a second Start and End Date, so you cant solve it by just focussing on the Max date 

 

You need to pick up the start date and look for the next bigger date for the same vehicle with a different user. That would be the end date for the first period 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.