Forum Discussion
Add rows with missing dates in Power Query
Good morning, I need to add the missing dates to the attendance list for each employee.
I have below information in my table
Employee ID
Month-Year,
Date,
Time in and Time Out
Thank you all very much!
pls try this
14 Replies
- Daniel29195Community Champion
Hello Anonymous
create a dimdate ( you can from here ) https://radacad.com/all-in-one-script-to-create-date-dimension-in-power-bi-using-power-query
then in power query, select the attendance table , and merge it with the dimdate .
choose the join type to be left join to dimdate . ( this way you get everything in dimdate that does not exist in your table ) .
1 --> your table
2--> dimdate table
3--> right join
let me know if it works for you .
NB ( you need to join with dimdate table having only dates for today's date so that you only return the dates missing until todays an not until end of year 2024 ) so maybe the dimdate created needs some minor tweaking .
If this answers your question , mark it as the solution ā so can you can help other people in the community find it easily .
- AhmedxSuper User
Can you please share your demo input and expected output!
- AnonymousNot applicable
Hi Ahmedx ,
Input Data
Employee ID Date Time In Time Out 100 27-12-2023 10 AM 5 PM 100 31-12-2023 9 AM 7 PM 200 27-12-202 9 AM 3 PM 200 31-12-2023 9 AM 9 PM
OutputEmployee ID Date Time In Time Out 100 01-12-2023 200 01-12-2023 100 02-12-2023 200 02-12-2023 100 03-12-2023 200 03-12-2023 100 04-12-2023 200 04-12-2023 .. .. 100 22-12-2023 200 22-12-2023 100 23-12-2023 200 23-12-2023 100 24-12-2023 200 24-12-2023 100 25-12-2023 200 25-12-2023 100 26-12-2023 200 26-12-2023 100 27-12-2023 10 AM 5 PM 200 27-12-2023 9 AM 3 PM 100 28-12-2023 200 28-12-2023 100 29-12-2023 200 29-12-2023 100 30-12-2023 200 30-12-2023 9 AM 7 PM 100 31-12-2023 9 AM 7 PM 200 31-12-2023 9 AM 9 PM - AnonymousNot applicable
Input Data
Employee ID Date Time In Time Out 100 27-12-2023 10 AM 5 PM 100 31-12-2023 9 AM 7 PM 200 27-12-202 9 AM 3 PM 200 31-12-2023 9 AM 9 PM
OutputEmployee ID Date Time In Time Out 100 01-12-2023 200 01-12-2023 100 02-12-2023 200 02-12-2023 100 03-12-2023 200 03-12-2023 100 04-12-2023 200 04-12-2023 .. .. 100 22-12-2023 200 22-12-2023 100 23-12-2023 200 23-12-2023 100 24-12-2023 200 24-12-2023 100 25-12-2023 200 25-12-2023 100 26-12-2023 200 26-12-2023 100 27-12-2023 10 AM 5 PM 200 27-12-2023 9 AM 3 PM 100 28-12-2023 200 28-12-2023 100 29-12-2023 200 29-12-2023 100 30-12-2023 200 30-12-2023 9 AM 7 PM 100 31-12-2023 9 AM 7 PM 200 31-12-2023 9 AM 9 PM
- AhmedxSuper User