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
j_logan
Frequent Visitor

Fill missing dates in Power Query

Hello.

I'd like to request help as I'm getting stuck enriching missing dates in my dataset.

I have an ID where the dates are complete from 4/12 to 5/12.

ideal.png

However, I have some several IDs where dates are not complete and I wish to enrich.

enrich1.pngenrich2.png

 

My target objective is similar to this:

outcome.png

 

What I did was:

- Created a calendar table from 4/12 to 5/16.

- Tried some Merge Query joins but failing to achieve desired outcome.

 

Thank you

1 ACCEPTED SOLUTION

Hi! @j_logan 

As I coudn't copy your data as it is an image. I've tried something on sample data.


I created 4,5 rows with dates and added an index with 1.

 

AnkitKukreja_0-1642928814677.png

 

Similarly I created a date table for the same month ( you can create for May and June as reqd in your case).
Then I added a column from same index 1 (Please ensure your date starts from the start date that you've in your data and ends untill the last desired date or last available date in your data whichever is oldest).

 

AnkitKukreja_1-1642928938319.png

 

Then I did a simple left join using merge on both the index and got this result. Now I can use this date instead of old 1.

 

AnkitKukreja_2-1642928996406.png

 

 

Just an fyi, if your data will add more rows every month. I would advise you to sanitize your data in the datasource (it seems excel to me) So you can just drag those date and that can autofill. This will not add running time on Power BI if your data gets bigger every day or month.

 

I hope this helps, please let me know if you want it to be doen on your dataset, please share your pbix.

 

If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.
Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

View solution in original post

2 REPLIES 2
vanessafvg
Super User
Super User

what is your merge join on? can you provide the m query code of what you are doing

 

what result are you getting from your soluton





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi! @j_logan 

As I coudn't copy your data as it is an image. I've tried something on sample data.


I created 4,5 rows with dates and added an index with 1.

 

AnkitKukreja_0-1642928814677.png

 

Similarly I created a date table for the same month ( you can create for May and June as reqd in your case).
Then I added a column from same index 1 (Please ensure your date starts from the start date that you've in your data and ends untill the last desired date or last available date in your data whichever is oldest).

 

AnkitKukreja_1-1642928938319.png

 

Then I did a simple left join using merge on both the index and got this result. Now I can use this date instead of old 1.

 

AnkitKukreja_2-1642928996406.png

 

 

Just an fyi, if your data will add more rows every month. I would advise you to sanitize your data in the datasource (it seems excel to me) So you can just drag those date and that can autofill. This will not add running time on Power BI if your data gets bigger every day or month.

 

I hope this helps, please let me know if you want it to be doen on your dataset, please share your pbix.

 

If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.
Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

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.