Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I wanted a way to sort a records without converting to a table ; I came up with this ,
if anyone has better solution or improvement I would be interested.
let
rec = [ B = "abc", E = 12, D = "def", C = 10 , A = 5] ,
orderby = Record.FromList(
List.Repeat( {null} , Record.FieldCount( rec)),
List.Sort( Record.FieldNames( rec),Order.Ascending)
)
in orderby & rec
Richard
Solved! Go to Solution.
You can try this...
let
rec = [ B = "abc", E = 12, D = "def", C = 10 , A = 5],
sortFields = List.Sort(Record.FieldNames(rec)),
sortRecord = Record.ReorderFields(rec, sortFields, MissingField.Ignore)
in
sortRecord
Proud to be a Super User! | |
just to add, i did not know there was a re order , there are just so many m functions it's frightening.
You can try this...
let
rec = [ B = "abc", E = 12, D = "def", C = 10 , A = 5],
sortFields = List.Sort(Record.FieldNames(rec)),
sortRecord = Record.ReorderFields(rec, sortFields, MissingField.Ignore)
in
sortRecord
Proud to be a Super User! | |
just to add, i did not know there was a re order , there are just so many m functions it's frightening.
Thanks, had not thoiught of that.
User | Count |
---|---|
11 | |
8 | |
5 | |
5 | |
4 |
User | Count |
---|---|
17 | |
14 | |
8 | |
6 | |
6 |