Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone,
i have a table with 3 colums:
A B C
A - serial number
B - number 1 or 2
C - serial number
Well my task is:
A B(1) B(2)
C C
Thank you
Solved! Go to Solution.
Hello @Anonymous
the Text.Combine has to be used as pivot-function of your third column. Here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRU0lFyAhHOhkqxOjABI5CAEUTACF2FEbKKWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t]),
#"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[B]), "B", "C", each Text.Combine(_,",")
)
in
#"Pivoted Column"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun und guten Rutsch 🙂
Jimmy
TY!!! - Wünsche Dir auch
maybe this explains better 🙂
Hello @Anonymous
the Text.Combine has to be used as pivot-function of your third column. Here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRU0lFyAhHOhkqxOjABI5CAEUTACF2FEbKKWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t]),
#"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[B]), "B", "C", each Text.Combine(_,",")
)
in
#"Pivoted Column"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun und guten Rutsch 🙂
Jimmy
Hello @Anonymous
your specification doesn't tell to much. However you can get the result by applying a pivoting-function on your 1or2 column using then SN1 as value column. But as I don't know to treat your value column, I simply applied a sum-function. This might not work in your scenario. Here the code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJRMgTjWB0wxwiMY2MB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [SN = _t, #"1or2" = _t, SN1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"SN", Int64.Type}, {"1or2", Int64.Type}, {"SN1", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"1or2", type text}}, "de-DE"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"1or2", type text}}, "de-DE")[#"1or2"]), "1or2", "SN1", List.Sum),
#"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"1", "1or2 - 1"}, {"2", "1or2 - 2"}})
in
#"Renamed Columns"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.