Forum Discussion
How do I return a calculated table sorted by a specific column?
Hi Aleef, thanks for the reply.
All your assumptions are correct about what I am trying to achieve and I will explore your suggestions fully over the next few days. Just as a starter though, I referenced the calculated table using the SAMPLE function and still, the data returns unsorted by the percentage column (as image below). I'm puzzled why it returns like that, I suspect I need to explore a bit more about evaluation and the order of which evaluation happens but logically (in my mind anyway) I feel this should return the table sorted descending by percentage!
I think it would need to look like:
Table 3 = SAMPLE(10,TableTest,[Motivated]/[Base], DESC)
So you are sorting by the expression, instead of the static column. You could also try:
Table 3 = SAMPLE(1,TableTest,MAX(TableTest[Percentage], DESC)
- SimonM10 years agoRegular Visitor
Hi ALeef
Thanks for the examples, my results based on your suggestions are below. So - example 1 is still not sorting, despite doing the calculation in the SAMPLE function.
Also, example 2 is showing some strange behaviour, even though I put 5 in the first value of SAMPLE, it returns the whole 10 rows (and again, not sorting!). I would have thought it would have returned 5 rows? I still need to try your Distinct Count solution on the Sector rather than a Group By so will do that over the weekend.
Thanks
Simon