Generate rows based on condition
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I have some data which looks like this.
Product | Year | Region |
A | 2010 | AP,EU |
A | 2013 | NA,AP,EU |
A | 2017 | NA,AP,EU |
B | 2011 | EU |
B | 2018 | EU,AP |
I would need to generate rows to show data for all the years between the years. For the last year for that product that is mentioned, i would need data to be populated for +3 years. Can any one please help me how do derive this?
My output should look like this.
Product | Year | Region |
A | 2010 | AP,EU |
A | 2011 | AP,EU |
A | 2012 | AP,EU |
A | 2013 | NA,AP,EU |
A | 2014 | NA,AP,EU |
A | 2015 | NA,AP,EU |
A | 2016 | NA,AP,EU |
A | 2017 | NA,AP,EU |
A | 2018 | NA,AP,EU |
A | 2019 | NA,AP,EU |
A | 2020 | NA,AP,EU |
B | 2011 | EU |
B | 2012 | EU |
B | 2013 | EU |
B | 2014 | EU |
B | 2015 | EU |
B | 2016 | EU |
B | 2017 | EU |
B | 2018 | EU,AP |
B | 2019 | EU,AP |
B | 2020 | EU,AP |
B | 2021 | EU,AP |
Solved! Go to Solution.
- Labels:
- Transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @hash_89,
would this help?
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This solution doesn't work for me. I'm not looking to add 4 rows for each row. It should be based on the year column for the product. For a product and year, it should have one row.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sorry @hash_89,
Misread it.
Here you go:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Perfect. Thank you very much.
