Forum Discussion

wnicholl's avatar
wnicholl
Resolver II
6 years ago
Solved

Sorting Issue

Sorting Issue   I’m having issues with sorting the yearly brackets in my column chart.  I tried to create a conditional column in query editor, however the supporting built off a few calculated col...
  • Anonymous's avatar
    Anonymous
    6 years ago
    Year Brackets Order =
    SWITCH(TRUE(),
    	'your_table'[Years as Member] <= 10, 10,
    	AND('your_table'[Years as Member] >= 11, 11,
    	AND('your_table'[Years as Member] >= 21, 21,
    	AND('your_table'[Years as Member] >= 31, 31,
    	AND('your_table'[Years as Member] >= 41, 41,
    	AND('your_table'[Years as Member] >= 51, 51,
    	AND('your_table'[Years as Member] >= 61, 61,
    	AND('your_table'[Years as Member] >= 71, 71,
    	AND('your_table'[Years as Member] >= 81, 81
    )

    In both tables create such a column and you're done. You'll use the column as the sorting column (hidden).

     

    Best

    D

  • Anonymous's avatar
    Anonymous
    6 years ago
    Instead of looking up, which by the way is a slow process, create one table with all the combinations, or relevant combinations, and then you'll have just one column which you can sort any way you want. Sometimes the answer does not lie in DAX but in the data model. Just change the model.

    There is a way to arbitrarily sort a measure's values but that requires stunts in the code, namely, attaching non-breaking invisible zero-width spaces to the values returned by the measure. You don't want to go that route.

    Best
    D