Forum Discussion
Reshaping Data from wide to Long
Hello.
I am looking or help on best practices for reshaping data in Power BI without using R or Python.
I have been given an HR file that contains the following information. Each instance (candidate +recruiter + job + location) has one row and all the events for that instance are columns like this:
| Person | Recruiter | Postion | location | Event1 | Event2 | Event3 | Event4 |
| 1 | A | 1234 | BOS | date1 | date2 | date3 | date4 |
| 1 | C | 3567 | BOS | date5 | date6 | date7 | date8 |
| 2 | A | 1368 | COS | date9 | date10 | date11 | date12 |
| 3 | B | 632 | ATL | date13 | date14 | date15 | date16 |
I need to make all the event columns into two columns event type and date like the table below. Is this possible?
| Person | Recruiter | Postion | location | Event Type | Date |
| 1 | A | 1234 | BOS | Event1 | date1 |
| 1 | A | 1234 | BOS | Event2 | date2 |
| 1 | A | 1234 | BOS | Event3 | date3 |
| 1 | A | 1234 | BOS | Event4 | date4 |
| 1 | C | 3567 | BOS | Event1 | date5 |
| 1 | C | 3567 | BOS | Event2 | date6 |
| 1 | C | 3567 | BOS | Event3 | date7 |
| 1 | C | 3567 | BOS | Event4 | date8 |
| 2 | A | 1368 | COS | Event1 | date9 |
| 2 | A | 1368 | COS | Event2 | date10 |
| 2 | A | 1368 | COS | Event3 | date11 |
| 2 | A | 1368 | COS | Event4 | date12 |
| 3 | B | 632 | ATL | Event1 | date13 |
| 3 | B | 632 | ATL | Event2 | date14 |
| 3 | B | 632 | ATL | Event3 | date15 |
| 3 | B | 632 | ATL | Event4 | date16 |
Try Unpivot
https://radacad.com/pivot-and-unpivot-with-power-bi
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
2 Replies
- amitchandak
Super User
Try Unpivot
https://radacad.com/pivot-and-unpivot-with-power-bi
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601 - AnonymousNot applicable
This solution was incredibly useful, it helped me reduce some work I was doing from hours to minutes.
Thanks.