Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Jay29
Regular Visitor

TABLE TRANSFORMATION

Hi everyone, 

I am working on a table that looks like this in PowerBI:

TypeCategoryDateRecordsPartyActivity
MA-HPHP-Auth6/1/202012345vendorproduct
MA-HPHP-Auth6/1/2020556729vendorsales
MA-HPHP-Auth6/1/202023245clientproduct
MA-HPHP-Auth6/1/2020227823clientsales

 

I want to transform (compress) it into the table below but can't seem to know how to go about it in PowerBI/PowerQuery. I need urgent help please. 

 

TypeCategoryDatePartyProductSales
MA-HPHP-Auth6/1/2020vendor12345556729
MA-HPHP-Auth6/1/2020client23245227823
1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

 

you should select the column Activity then transform with the pivot Column tool 

image.png

 

 

 

 

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nVU0lHyCAASZvqG+kYGQIahkbEJkCpLzUvJLwIyCoryU0qTS5RidbAqNzUzt0BWXpyYk1qMS7GloYGhIZBOzslMzSshbLihsaEJsnKo4bEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Type = _t, Category = _t, Date = _t, Records = _t, Party = _t, Activity = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}, {"Category", type text}, {"Date", type date}, {"Records", Int64.Type}, {"Party", type text}, {"Activity", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Activity]), "Activity", "Records", List.Sum)
in
    #"Pivoted Column"

 

View solution in original post

3 REPLIES 3
Jay29
Regular Visitor

I guess the table was a little clumsy.

This is what I am working on:

TypeCategoryDateRecordsPartyActivity
MAHP6/1/201234vendorproduct
MAHP6/1/205678vendorsales
MAHP6/1/2091011clientproduct
MAHP6/1/201314clientsales

 

This is how I want it to look like (transformed/compressed)

TypeCategoryDatePartyProductSales
MAHP6/1/20vendor12345678
MAHP6/1/20client910111314

 

Anonymous
Not applicable

 

 

you should select the column Activity then transform with the pivot Column tool 

image.png

 

 

 

 

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nVU0lHyCAASZvqG+kYGQIahkbEJkCpLzUvJLwIyCoryU0qTS5RidbAqNzUzt0BWXpyYk1qMS7GloYGhIZBOzslMzSshbLihsaEJsnKo4bEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Type = _t, Category = _t, Date = _t, Records = _t, Party = _t, Activity = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}, {"Category", type text}, {"Date", type date}, {"Records", Int64.Type}, {"Party", type text}, {"Activity", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Activity]), "Activity", "Records", List.Sum)
in
    #"Pivoted Column"

 

@Anonymous , many thanks. It worked like magic!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.