Forum Discussion
SebaSpotti
Advocate II
1 year agoUnpivot a table with dates beetwen
Hi all! I have a table like this : Start_Date End_Date Type_of_Car Number 20/10/2024 25/10/2024 Car A 2 08/02/2024 12/02/2024 Car B 3 and I want to obtain (with power qu...
- 1 year ago
Hi SebaSpotti
You can refer this post:
https://amitchandak.medium.com/power-query-get-all-dates-between-the-start-and-end-date-9ad6a84cf5f2it should resolved your issue, and if it does please give this a thumbs up and accept the solution
Many Thanks
Dark
Bibiano_Geraldo
Super User
1 year agoHi SebaSpotti ,
Make sure that your Start_Date and End_Date the data type was set to date in power query.
After that, you can add a new custom column using this M code:
List.Dates([Start_Date], Duration.Days([End_Date] - [Start_Date]) + 1, #duration(1,0,0,0))Expand the Date List:
- Click the small icon with arrows at the top-right of the Date_List column.
- Select Expand to New Rows. This will create a row for each date in the range.
Now your data look like this:
Rename the new column to Date.
Remove the original Start_Date and End_Date columns if they are no longer needed.
Your final result should look like this: