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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
SonaSinghA
Helper III
Helper III

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!

1 ACCEPTED SOLUTION

14 REPLIES 14
Ahmedx
Super User
Super User

pls try this

Screenshot_2.png

Hi @Ahmedx , thanks for the quick solution.
I need all the missing days for the month.
Also, I added one more user to the solution, giving some errors..

post an example and show what result you are expecting

Hi @Ahmedx ,

Input Data

Employee IDDateTime InTime Out
10027-12-202310 AM5 PM
10031-12-20239 AM7 PM
20027-12-2029 AM3 PM
20031-12-20239 AM9 PM


Output

Employee IDDateTime InTime Out
10001-12-2023  
20001-12-2023  
10002-12-2023  
20002-12-2023  
10003-12-2023  
20003-12-2023  
10004-12-2023  
20004-12-2023  
 ..  
 ..  
10022-12-2023  
20022-12-2023  
10023-12-2023  
20023-12-2023  
10024-12-2023  
20024-12-2023  
10025-12-2023  
20025-12-2023  
10026-12-2023  
20026-12-2023  
10027-12-202310 AM5 PM
20027-12-20239 AM3 PM
10028-12-2023  
20028-12-2023  
10029-12-2023  
20029-12-2023  
10030-12-2023  
20030-12-20239 AM7 PM
10031-12-20239 AM7 PM
20031-12-20239 AM9 PM



pls try this

 

Hi @Ahmedx,
There is one issue in the solution: missing dates are showing based on the max date; if there is no record for one employee for the last week, then those days are not showing. Can you please suggest a solution for this?

Thank you so much for the effort and support @Ahmedx.

One thing: I removed last year's data and some unwanted fields before grouping, but after expanding the data, last year's data and removed fields are also showing.
Can you please guide me to learn advanced power-query skills?

If you removed last year's data and some unnecessary fields before grouping, then after expanding the data these fields should not appear.

give an example or your file I will help

Yes, correct @Ahmedx. I forgot to update the previous step name for the grouping step.

Can you please suggest some resources for learning advanced power query.

Daniel29195
Super User
Super User

Hello @SonaSinghA 

 

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 ) . 

 

 

Daniel29195_0-1707722801366.png

 

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 . 

 

 

Ahmedx
Super User
Super User

Can you please share your demo input and expected output!

Input Data

Employee IDDateTime InTime Out
10027-12-202310 AM5 PM
10031-12-20239 AM7 PM
20027-12-2029 AM3 PM
20031-12-20239 AM9 PM


Output

Employee IDDateTime InTime Out
10001-12-2023  
20001-12-2023  
10002-12-2023  
20002-12-2023  
10003-12-2023  
20003-12-2023  
10004-12-2023  
20004-12-2023  
 ..  
 ..  
10022-12-2023  
20022-12-2023  
10023-12-2023  
20023-12-2023  
10024-12-2023  
20024-12-2023  
10025-12-2023  
20025-12-2023  
10026-12-2023  
20026-12-2023  
10027-12-202310 AM5 PM
20027-12-20239 AM3 PM
10028-12-2023  
20028-12-2023  
10029-12-2023  
20029-12-2023  
10030-12-2023  
20030-12-20239 AM7 PM
10031-12-20239 AM7 PM
20031-12-20239 AM9 PM

 

Hi @Ahmedx ,

Input Data

Employee IDDateTime InTime Out
10027-12-202310 AM5 PM
10031-12-20239 AM7 PM
20027-12-2029 AM3 PM
20031-12-20239 AM9 PM


Output

Employee IDDateTime InTime Out
10001-12-2023  
20001-12-2023  
10002-12-2023  
20002-12-2023  
10003-12-2023  
20003-12-2023  
10004-12-2023  
20004-12-2023  
 ..  
 ..  
10022-12-2023  
20022-12-2023  
10023-12-2023  
20023-12-2023  
10024-12-2023  
20024-12-2023  
10025-12-2023  
20025-12-2023  
10026-12-2023  
20026-12-2023  
10027-12-202310 AM5 PM
20027-12-20239 AM3 PM
10028-12-2023  
20028-12-2023  
10029-12-2023  
20029-12-2023  
10030-12-2023  
20030-12-20239 AM7 PM
10031-12-20239 AM7 PM
20031-12-20239 AM9 PM

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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