Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
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 ;). |
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 ;). |
Thank you so much. This works perfectly.