Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Good
I would like to know with which dax code I can put the 3 columns together. That is, I want to create a new column where for each row I get together, ordering the numbers in ascending order. I want each number to go first to the smallest and so on in order to the largest.
For example:
It should be the new column:
11 18 31
14 17 39
But also a new board
Where the columns are like this
Num1 Num 2 Num3
11 18 31
That is, I created a new table with new columns and ordered each row numerically.
Thank you very much for your support
Solved! Go to Solution.
Your data is not in a usable format. Add a row number column and then unpivot the other columns. There is no need to pivot them back but you can add an index column if you want.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjZU0lEytAARhkqxOtFKhiYgtjmQMLZUio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Num1 = _t, Num2 = _t, Num3 = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Row", 1, 1, Int64.Type),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Added Index", {"Row"}, "Number", "Value"),
#"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Value", Int64.Type}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"Row", Order.Ascending}, {"Value", Order.Ascending}}),
#"Grouped Rows" = Table.Group(#"Sorted Rows", {"Row"}, {{"Rows", each Table.AddIndexColumn(_, "Column", 1, 1, Int64.Type), type table [ Value=nullable Int64.Type, Column=Int64.Type]}}),
#"Expanded Rows" = Table.ExpandTableColumn(#"Grouped Rows", "Rows", {"Value", "Column"}, {"Value", "Column"})
in
#"Expanded Rows"
You can then put that in a matrix visual
The code works for any number of columns, and no DAX is required.
Your data is not in a usable format. Add a row number column and then unpivot the other columns. There is no need to pivot them back but you can add an index column if you want.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjZU0lEytAARhkqxOtFKhiYgtjmQMLZUio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Num1 = _t, Num2 = _t, Num3 = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Row", 1, 1, Int64.Type),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Added Index", {"Row"}, "Number", "Value"),
#"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Value", Int64.Type}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"Row", Order.Ascending}, {"Value", Order.Ascending}}),
#"Grouped Rows" = Table.Group(#"Sorted Rows", {"Row"}, {{"Rows", each Table.AddIndexColumn(_, "Column", 1, 1, Int64.Type), type table [ Value=nullable Int64.Type, Column=Int64.Type]}}),
#"Expanded Rows" = Table.ExpandTableColumn(#"Grouped Rows", "Rows", {"Value", "Column"}, {"Value", "Column"})
in
#"Expanded Rows"
You can then put that in a matrix visual
The code works for any number of columns, and no DAX is required.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |