Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
In order to create a radar visualization, I need to do some pivoting and unpivoting of my data.
My data looks like below:
Name | stats1 | stats2 | stats3 | stats4 |
Jack | 526.4 | 578.4 | 54785 | 7451 |
Henry | 1254 | 94652.7 | 2154 | 2047 |
Smith | 1487.2 | 4524 | 1478 | 3087 |
Daniel | 4152.7 | 1479 | 3641 | 1480 |
Olivia | 7884.9 | 48965 | 2054 | 4308 |
I want to make it into the following shape:
Metrics | Jack | Henry | Smith | Daniel | Olivia |
stats1 | 526.4 | 1254 | 1487.2 | 4152.7 | 7884.9 |
stats2 | 578.4 | 94652.7 | 4524 | 1479 | 48965 |
stats3 | 54785 | 2154 | 1478 | 3641 | 2054 |
stats4 | 7451 | 2047 | 3087 | 1480 | 4308 |
Is there anyone who can help me with this?
Solved! Go to Solution.
Paste the below into the advanced editor of a blank query.
let
Source = Table.FromRows(
Json.Document(
Binary.Decompress(
Binary.FromText(
"XY5BC8IwDIX/ivQ8ypqlTXb3IB704HHsUGRgcdvBFcF/b5oKir28l5cvSYfBnOIy7eozjdlyzJv7q+HHd1+LYsdmMMd4vUvmIVgsSlwVib0ooXfKHab18ZLAgS/9HoMHS+LAaQAtkoKXJeVbAZHJghj0gFoTi3QtV24f1zTNpe8+m4ToCxHQ1flWwfOcnimWvzCjLQRyH7ze1NMoO804vgE=",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ((type nullable text) meta [Serialized.Text = true])
in
type table [
#"(blank)" = _t,
#"(blank).1" = _t,
#"(blank).2" = _t,
#"(blank).3" = _t,
#"(blank).4" = _t
]
),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
#"Changed Type" = Table.TransformColumnTypes(
#"Promoted Headers",
{
{"stats1 ", type number},
{"stats2 ", type number},
{"stats3 ", Int64.Type},
{"stats4 ", Int64.Type}
}
),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(
#"Changed Type",
{"Name "},
"Attribute",
"Value"
),
#"Pivoted Column" = Table.Pivot(
#"Unpivoted Other Columns",
List.Distinct(#"Unpivoted Other Columns"[#"Name "]),
"Name ",
"Value",
List.Sum
)
in
#"Pivoted Column"
Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
If you found this post helpful, please give Kudos. It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen. If you find my signature vaguely amusing, please give Kudos. | Proud to be a Super User! |
Paste the below into the advanced editor of a blank query.
let
Source = Table.FromRows(
Json.Document(
Binary.Decompress(
Binary.FromText(
"XY5BC8IwDIX/ivQ8ypqlTXb3IB704HHsUGRgcdvBFcF/b5oKir28l5cvSYfBnOIy7eozjdlyzJv7q+HHd1+LYsdmMMd4vUvmIVgsSlwVib0ooXfKHab18ZLAgS/9HoMHS+LAaQAtkoKXJeVbAZHJghj0gFoTi3QtV24f1zTNpe8+m4ToCxHQ1flWwfOcnimWvzCjLQRyH7ze1NMoO804vgE=",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ((type nullable text) meta [Serialized.Text = true])
in
type table [
#"(blank)" = _t,
#"(blank).1" = _t,
#"(blank).2" = _t,
#"(blank).3" = _t,
#"(blank).4" = _t
]
),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
#"Changed Type" = Table.TransformColumnTypes(
#"Promoted Headers",
{
{"stats1 ", type number},
{"stats2 ", type number},
{"stats3 ", Int64.Type},
{"stats4 ", Int64.Type}
}
),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(
#"Changed Type",
{"Name "},
"Attribute",
"Value"
),
#"Pivoted Column" = Table.Pivot(
#"Unpivoted Other Columns",
List.Distinct(#"Unpivoted Other Columns"[#"Name "]),
"Name ",
"Value",
List.Sum
)
in
#"Pivoted Column"
Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
If you found this post helpful, please give Kudos. It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen. If you find my signature vaguely amusing, please give Kudos. | Proud to be a Super User! |
Thank you so much. This works perfectly.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
107 | |
68 | |
48 | |
44 | |
43 |