Forum Discussion
Help with Formatting a Dataset
Hello,
I am working on formatting the below sample dataset:
| ID | Key | Value |
| 123 | Status | Active |
| 123 | Country | USA |
| 456 | Status | Inactive |
| 456 | Country | Canada |
This is what I want the table to look like:
| ID | Status | Country |
| 123 | Active | USA |
| 456 | Inactive | Canada |
I have tried using Pivot Column on the Key column from fig.1 and this is what I get:
| ID | Status | Country |
| 123 | Active | null |
| 123 | null | USA |
| 456 | Inactive | null |
| 456 | null | Canada |
I think im close and im probably missing a pretty easy step, but any help would be greatly appreciated!
There two options.
1. Pivot the data with advance option as No summarization/Aggeration. Under Edit Queries or Transform data.
2. Or display it in Matix with First Agg on Values.
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/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601Try
Summ = SUMMARIZE(transpose,transpose[personID],transpose[Org],transpose[updatedAt],"Status",maxx(filter(transpose,transpose[Key]="Status"),transpose[Value]), "Country",maxx(filter(transpose,transpose[Key]="Country"),transpose[Value]))Check : https://www.dropbox.com/s/hqlasw6q9smkybr/Transpose.pbix?dl=0
3 Replies
- amitchandakSuper User
There two options.
1. Pivot the data with advance option as No summarization/Aggeration. Under Edit Queries or Transform data.
2. Or display it in Matix with First Agg on Values.
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/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601- AnonymousNot applicable
Thanks for your response amitchandak . I have tried using pivot column with Dont Aggregate selected under Advanced Options. This is when I get multiple entries for the same user and null as their values (figure 3 in original post). Perhaps I made an error in my initial post by oversimplifying my dataset. This is an actual representation of the dataset, with this sample, I receive multiple entries for the same ID with null in the value columns:
_id Key Org personID updatedAt Value a;kljsd;fjsd;f Status 1234567 123 1/1/2000 Active askldf;asdfjk Country 1234567 123 1/1/2000 USA sklafh;kfg;ak Status 1234567 456 1/2/2000 Inactive skdf;klasdfj Country 1234567 456 1/2/2000 Canada The _id field is a generic guid assigned uniquely and randomly to every row in the table. When I pivot with Dont Aggregate selected, this is my result:
_id org personaID updatedAt Status Country a;kljsd;fjsd;f 1234567 123 1/1/2000 Active null askldf;asdfjk 1234567 123 1/1/2000 null USA skdf;klasdfj 1234567 456 1/2/2000 null Canada sklafh;kfg;ak 1234567 456 1/2/2000 Inactive null I want to combine everything on the personaID and I think the _id field is getting in the way. Other than deleting the _id column, is there a way to further aggregate or group on the personaID?
- amitchandakSuper User
Try
Summ = SUMMARIZE(transpose,transpose[personID],transpose[Org],transpose[updatedAt],"Status",maxx(filter(transpose,transpose[Key]="Status"),transpose[Value]), "Country",maxx(filter(transpose,transpose[Key]="Country"),transpose[Value]))Check : https://www.dropbox.com/s/hqlasw6q9smkybr/Transpose.pbix?dl=0