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,
I am fairly new to Power BI and this forum has helped me many times already. However I can't find the answer for the following problem.
I have data from a database that looks like this:
ID | Name | A1 | B1 | C1 | A2 | B2 | C2 |
1 | X | A1 | B1 | C1 | A2 | B2 | C2 |
I want the A1 en A2 in the same column on different rows using DAX. So I want it to look like this:
ID | Name | A | B | C |
1 | X | A1 | B1 | C1 |
1 | X | A2 | B2 | C2 |
Is this possible?
Thanks in advance.
Solved! Go to Solution.
@Ferris , Try this in power query.
Paste the code in a blank query in power query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUYoAYkcQwwlEOIMIRyMQF0Q4GynFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Name = _t, A1 = _t, B1 = _t, C1 = _t, A2 = _t, B2 = _t, C2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}, {"A1", type text}, {"B1", type text}, {"C1", type text}, {"A2", type text}, {"B2", type text}, {"C2", type text}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Name", "ID"}, "Attribute", "Value"),
#"Split Column by Character Transition" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByCharacterTransition((c) => not List.Contains({"0".."9"}, c), {"0".."9"}), {"Attribute.1", "Attribute.2"}),
#"Pivoted Column" = Table.Pivot(#"Split Column by Character Transition", List.Distinct(#"Split Column by Character Transition"[Attribute.1]), "Attribute.1", "Value")
in
#"Pivoted Column"
@Ferris , Try this in power query.
Paste the code in a blank query in power query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUYoAYkcQwwlEOIMIRyMQF0Q4GynFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Name = _t, A1 = _t, B1 = _t, C1 = _t, A2 = _t, B2 = _t, C2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}, {"A1", type text}, {"B1", type text}, {"C1", type text}, {"A2", type text}, {"B2", type text}, {"C2", type text}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Name", "ID"}, "Attribute", "Value"),
#"Split Column by Character Transition" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByCharacterTransition((c) => not List.Contains({"0".."9"}, c), {"0".."9"}), {"Attribute.1", "Attribute.2"}),
#"Pivoted Column" = Table.Pivot(#"Split Column by Character Transition", List.Distinct(#"Split Column by Character Transition"[Attribute.1]), "Attribute.1", "Value")
in
#"Pivoted Column"
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.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |