# Dataset: sort rows in descending order of first column

I am new in the Mathematica community and I have a probably easy question for you regarding how to sort a dataset as the following so that I have sorted the values in the fist row descending from 44 in the first line down to 3 in the last line.

dataset = Dataset[{
<|"a" -> 6, "b" -> "x", "c" -> {1}|>,
<|"a" -> 8, "b" -> "y", "c" -> {2, 3}|>,
<|"a" -> 44, "b" -> "z", "c" -> {3}|>,
<|"a" -> 4, "b" -> "x", "c" -> {4, 5}|>,
<|"a" -> 5, "b" -> "y", "c" -> {5, 6, 7}|>,
<|"a" -> 3, "b" -> "z", "c" -> {}|>}]

• dataset[SortBy[-#a &]]. Mar 20, 2015 at 18:38
• ..... or dataset[SortBy[a]][Reverse] ;-) Mar 20, 2015 at 18:42
• Perfect!! Thank you very much for the quick response!! Mar 20, 2015 at 18:52
• dataset[SortBy[a] /* Reverse] Mar 20, 2015 at 20:07
• Reverse @ Sort@ ds Mar 21, 2015 at 3:08

dataset[SortBy[-#a &]]

• I corrected SortBy[a] to SortBy["a"]. The former does produce the correct result, but that's just a coincidence. It's in fact equivalent to a simple Sort and the symbol a makes no difference, one could write b or c and it wouldn't change the result. May 17, 2015 at 17:47