Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
If I have a table like this:
How can I widen it into something like this:
Thank you for your help.
Solved! Go to Solution.
I actually ran into a similar problem yesterday. So first make sure this is the way you want to model it vs splitting up employees and tests. If this is what you actually need, here are the steps...you have two options:
Option A (easy but requires multiple tables)
Option B (more difficult but able to do with just one table)
The downside with both these solutions is if there is ever a Test D you will have to write that into the query.
Hi @Anonymous ,
Although the @PANDAmonium is a good solution this is a very complex way of making this work.
Based on the solution given on this blog post there is a much easier way of making this work:
[Test] & "," &[Attribute]
Check the full code below:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hc/BDsIgDAbgVzE98xKOeJgHL9tt4YBYFxQ7w6aJb7+CnTGGxQNQkq/0p+tgb90VFDQ24Mhni+O02XKheV0spf1BYFRZVlwcGkEK7D2uUr3QhBQMbnpTHwJfd9R7Ioye+t8UNDzzgPDHV+XUq/4T6GajtOUGpNRft9855I9B4hTdMv+ETh4tMi3sjMfMXmDMDA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Employee = _t, Job = _t, Test = _t, Status = _t, date1 = _t, Date2 = _t]),
#"Unpivoted Columns1" = Table.UnpivotOtherColumns(Source, {"Employee", "Job", "Test"}, "Attribute", "Value"),
#"Added Custom" = Table.AddColumn(#"Unpivoted Columns1", "Test_Column_Name", each [Test] & "," &[Attribute]),
#"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Test", "Attribute"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns1", List.Distinct(#"Removed Columns1"[Test_Column_Name]), "Test_Column_Name", "Value")
in
#"Pivoted Column"
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
Although the @PANDAmonium is a good solution this is a very complex way of making this work.
Based on the solution given on this blog post there is a much easier way of making this work:
[Test] & "," &[Attribute]
Check the full code below:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hc/BDsIgDAbgVzE98xKOeJgHL9tt4YBYFxQ7w6aJb7+CnTGGxQNQkq/0p+tgb90VFDQ24Mhni+O02XKheV0spf1BYFRZVlwcGkEK7D2uUr3QhBQMbnpTHwJfd9R7Ioye+t8UNDzzgPDHV+XUq/4T6GajtOUGpNRft9855I9B4hTdMv+ETh4tMi3sjMfMXmDMDA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Employee = _t, Job = _t, Test = _t, Status = _t, date1 = _t, Date2 = _t]),
#"Unpivoted Columns1" = Table.UnpivotOtherColumns(Source, {"Employee", "Job", "Test"}, "Attribute", "Value"),
#"Added Custom" = Table.AddColumn(#"Unpivoted Columns1", "Test_Column_Name", each [Test] & "," &[Attribute]),
#"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Test", "Attribute"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns1", List.Distinct(#"Removed Columns1"[Test_Column_Name]), "Test_Column_Name", "Value")
in
#"Pivoted Column"
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsOh, cool. I had to try this for myself; I was hoping someone had a better solution.
Yeah, go with @MFelix solution. That is much cleaner and removes any issues of new tests.
I actually ran into a similar problem yesterday. So first make sure this is the way you want to model it vs splitting up employees and tests. If this is what you actually need, here are the steps...you have two options:
Option A (easy but requires multiple tables)
Option B (more difficult but able to do with just one table)
The downside with both these solutions is if there is ever a Test D you will have to write that into the query.
The multiple table scenario worked thank you!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |