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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Special Transpose to get output

Hi , I need to transpose a dataset to get a specific value.

Here is my Input table

camel12_1-1695231538808.png

Below is my output table.

camel12_0-1695231522800.png

 

For each ticket in the input table I need to get the key values as columns and its corresponding values as values in the table. Please note that I cannot directly use a transpose as the dataset is very huge.

Please help me with the above request and let me know if any more info is required or need further explanation.

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous Can you just Pivot the Key column?

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwVNJRcnQEEoZKsTpwAScgUZKRiizkDFJjZAwVMoJpMzJBFgHpS0xKRhaC6IOKGMNtQxEBaTMyNkEWAmlzdHFGFnIBEmUpSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Tickets = _t, Key = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Tickets", Int64.Type}, {"Key", type text}, {"Value", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Key]), "Key", "Value")
in
    #"Pivoted Column"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Greg_Deckler I forgot to check that dont aggregate option. Thanks it works now.

Greg_Deckler
Super User
Super User

@Anonymous Can you just Pivot the Key column?

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwVNJRcnQEEoZKsTpwAScgUZKRiizkDFJjZAwVMoJpMzJBFgHpS0xKRhaC6IOKGMNtQxEBaTMyNkEWAmlzdHFGFnIBEmUpSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Tickets = _t, Key = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Tickets", Int64.Type}, {"Key", type text}, {"Value", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Key]), "Key", "Value")
in
    #"Pivoted Column"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  I have tried this but I'm not getting the desired output as my dataset is huge, I'm just getting 0 and 1 in my output. The method of pivoting key field would work for small use cases. What do I do

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors