SOLVED
Populate records for missing dates
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
aokalabak
5 - Atom
‎05-05-2018
11:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Dear all,
I have an excel file with departure data, like
DepartFrom | DepartDate | TotalCount |
LA | 01.03.2018 | 2 |
LA | 04.03.2018 | 4 |
LA | 07.03.2018 | 3 |
for missing dates, I want to populate rows with TotalCount=0, final data will be like
DepartFrom | DepartDate | TotalCount |
LA | 01.03.2018 | 2 |
LA | 02.03.2018 | 0 |
LA | 03.03.2018 | 0 |
LA | 04.03.2018 | 4 |
LA | 05.03.2018 | 0 |
LA | 06.03.2018 | 0 |
LA | 07.03.2018 | 3 |
I tried join and union tools, prepared another excel sheet containing missing dates and merge two files but somehow I couldn't find a way.
Is there a way to populate values for missing dates?
Thanks in advance
Ahmet
Solved! Go to Solution.
Labels:
- Labels:
- Preparation
4 REPLIES 4
LordNeilLord
15 - Aurora
‎05-05-2018
02:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @aokalabak
Here's how to get the answer:
1. Using summarize tool, group by departfrom and return min & max departdate
2. Use generate Rows tool to fill all the dates between min & max
3. Join this back to your original file using date as the join criteria
4. Union the left (or right depending on how you did the join) and join output to get a complete list
5. Use the formula tool (or data cleanse) to turn the null Total Count into zero
Let me know if any of that doesn't make sense
Neil
Here's how to get the answer:
1. Using summarize tool, group by departfrom and return min & max departdate
2. Use generate Rows tool to fill all the dates between min & max
3. Join this back to your original file using date as the join criteria
4. Union the left (or right depending on how you did the join) and join output to get a complete list
5. Use the formula tool (or data cleanse) to turn the null Total Count into zero
Let me know if any of that doesn't make sense
Neil
‎05-06-2018
09:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @LordNeilLord, this worked :)
Kind regards,
Ahmet
ACE Emeritus
‎05-06-2018
12:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
kpombo
7 - Meteor
‎04-01-2019
12:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can you post a workflow example for this? I am having trouble getting the generate rows tool to work.
