Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
So I have a table that looks like this:
I want to transformat it into something that looks like this:
Any idea what would be the way to do this in DAX?
Solved! Go to Solution.
Hi @Mat87,
If you allow, you can edit the table in Query Edit.
1. Please select Year column->Pivot Column.
2. After click Pivot Column->value field.
3. Then alick close&Apply, you will get theexpected result.
In addition, this is the Power Query statement.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTIyMDQGUcamJkZKsTpwQRMQZWJkAhZLAosZWILFDI2QxSyAlKmpEUgwFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Year = _t, value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Year", Int64.Type}, {"value", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"Year", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"Year", type text}}, "en-US")[Year]), "Year", "value", List.Sum)
in
#"Pivoted Column"
Please feel free to ask if you have any issue.
Best Regards,
Angelia
Thanks guys.
Hi @Mat87,
If you allow, you can edit the table in Query Edit.
1. Please select Year column->Pivot Column.
2. After click Pivot Column->value field.
3. Then alick close&Apply, you will get theexpected result.
In addition, this is the Power Query statement.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTIyMDQGUcamJkZKsTpwQRMQZWJkAhZLAosZWILFDI2QxSyAlKmpEUgwFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Year = _t, value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Year", Int64.Type}, {"value", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"Year", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"Year", type text}}, "en-US")[Year]), "Year", "value", List.Sum)
in
#"Pivoted Column"
Please feel free to ask if you have any issue.
Best Regards,
Angelia
I assume you ask how display the table in the desired format and not to change the table itself.
You can use the Matrix.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |