Forum Discussion
Compare, Replace values based on Condition
I have this table shown below. I want to group by Site and if SFID is blank for Status Active and SFID is populated for Deselect then the values of SFID, task and Workflow needs to move from row 3 to row 2.
Original Data
| Sno | Site | Status | SFID | Type | Task | WorkFlow |
| 1 | Site A | null | null | Swift | ||
| 2 | Site A | Active | null | Swift | ||
| 3 | Site A | Deselect | 2929194 | Retain | 2 | INSTALL |
| 4 | Site B | null | null | Swift | ||
| 5 | Site B | Active | null | Swift | ||
| 6 | Site B | Deselect | 2928855 | Retain | 2 | INSTALL |
| 7 | Site C | Active | 1234567 | Retain | 2 | INSTALL |
| 8 | Site D | Active | 1235668 | Swift | 2 | INSTALL |
| 9 | Site D | Deselect | 1235639 | Retain | 2 | DAS |
| 10 | Site D | Active | 1278537 | BH | 2 | GUP |
Result should look like this as below
| Sno | Site | Status | SFID | Type | Task | WorkFlow |
| 1 | Site A | null | null | Swift | ||
| 2 | Site A | Active | 2929194 | Swift | 2 | INSTALL |
| 3 | Site A | Deselect | null | Retain | ||
| 4 | Site B | null | null | Swift | ||
| 5 | Site B | Active | 2928855 | Swift | 2 | INSTALL |
| 6 | Site B | Deselect | null | Retain | ||
| 7 | Site C | Active | 1234567 | Retain | 2 | INSTALL |
| 8 | Site D | Active | 1235668 | Swift | 2 | INSTALL |
| 9 | Site D | Deselect | 1235639 | Retain | 2 | DAS |
| 10 | Site D | Active | 1278537 | BH | 2 | GUP |
Any help is appreciated.
Thanks
I found the solution. This video tells exactly what I was looking for.
Refer to Previous Row for Subgroups in Power Query - YouTube
2 Replies
- Manjarigoyal1Frequent Visitor
I found the solution. This video tells exactly what I was looking for.
Refer to Previous Row for Subgroups in Power Query - YouTube
- v-yanjiang-msftCommunity Support
Hi Manjarigoyal1 ,
Glad your problem is solved!
If you have no other problems, would you mind accept your reply as solution? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.
Best Regards,
Community Support Team _ kalyj