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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Pivot Sales data to show true false if appearing in transaction

Hi, 

 

I currently have the below format of data:

ChrisHedges_0-1660701828388.png

 

I would like to get it to look like something like this:

ChrisHedges_2-1660701918578.png

I tried to pivot columns and it gave me this:

 

ChrisHedges_3-1660701985618.png

 

 

1 ACCEPTED SOLUTION
jbwtp
Memorable Member
Memorable Member

Hi @Anonymous,,

 

Something like this?

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLKz8hTitWJVjICcRKTs8EcYyAnILE0B84Jy0zOrkSoy1eKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [incremental_id = _t, name = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"incremental_id", Int64.Type}, {"name", type text}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "incremental_id", "incremental_id - Copy"),
    #"Pivoted Column" = Table.Pivot(#"Duplicated Column", List.Distinct(#"Duplicated Column"[name]), "name", "incremental_id - Copy", (x)=>List.ContainsAny(#"Duplicated Column"[#"incremental_id - Copy"], x))
in
    #"Pivoted Column"

 

Kind regards,

John

View solution in original post

1 REPLY 1
jbwtp
Memorable Member
Memorable Member

Hi @Anonymous,,

 

Something like this?

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLKz8hTitWJVjICcRKTs8EcYyAnILE0B84Jy0zOrkSoy1eKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [incremental_id = _t, name = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"incremental_id", Int64.Type}, {"name", type text}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "incremental_id", "incremental_id - Copy"),
    #"Pivoted Column" = Table.Pivot(#"Duplicated Column", List.Distinct(#"Duplicated Column"[name]), "name", "incremental_id - Copy", (x)=>List.ContainsAny(#"Duplicated Column"[#"incremental_id - Copy"], x))
in
    #"Pivoted Column"

 

Kind regards,

John

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.