Forum Discussion
hamzashafiq
3 years agoKudo Collector
Insert 12 Rows for each ID in Power Query
Hey Guys, I have a dataset, I want to insert 12 rows for each ID in the table using Power Query and insert blank in other records except ID. How can I do that? Data: ID Month Year Sales ...
- 3 years ago
hamzashafiq
3 years agoKudo Collector
Hi Ahmedx I tried your solution and it's working thank you. Now let's see how the actual data looks like.
| Data | |||
| ID | Group | Year Month | Transaction Amount |
| 1 | History Start | Jan-23 | 10 |
| 1 | Sales | Feb-23 | 20 |
| 1 | Sales | Mar-23 | 30 |
| 1 | Sales | May-23 | 40 |
| 2 | History Start | Mar-23 | 10 |
| 2 | Sales | Apr-23 | 20 |
| 2 | Sales | May-23 | 30 |
| 2 | Sales | Jul-23 | 40 |
In the data you see for each ID (1 and 2) one of the month is missing (ID 1 miss April and ID 2 miss June), we need to insert only that row which is missing, the insertion should start from the date where Group = "History Start" and end at Max date of "Year Month" for each ID. Below is the required output.
| Output | |||
| ID | Group | Year Month | Transaction Amount |
| 1 | History Start | Jan-23 | 10 |
| 1 | Sales | Feb-23 | 20 |
| 1 | Sales | Mar-23 | 30 |
| 1 | Sales | Apr-23 | 0 |
| 1 | Sales | May-23 | 40 |
| 2 | History Start | Mar-23 | 10 |
| 2 | Sales | Apr-23 | 20 |
| 2 | Sales | May-23 | 30 |
| 2 | Sales | Jun-23 | 0 |
| 2 | Sales | Jul-23 | 40 |
Ahmedx
3 years agoSuper User
- hamzashafiq3 years agoKudo Collector
Ahmedx Perfect, Thank you so much.