10 Replies Latest reply on Aug 19, 2016 7:47 AM by Andrew Watson

# Sorting Dimensions by Calculated Fields That Use Table Calculations

Hi,

I have a table calculation that I'd like to sort by.  Its essentially sorting employee names by the fill rate of their sessions.  I tried using the zn() and it didnt work.  If I right click on employee names, hit sort, the fill rate field isnt available (I assume because it's a table calc).  Is there any other workaround, e.g., LOD or rank?

The fill rate calc is :

zn(window_sum(sum([reservations]))/window_sum(sum([Capacity])))

Thanks!

• ###### 1. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

Put the calculated field you wish to sort by as the first pill (the left hand pill) in the rows shelf and ensure it's discrete (blue). It has to be the first pill in the rows. You can uncheck 'Show Header' to hide it. Note if you find it sorts the wrong way to that you wish then multiply the result by -1 in a new calculated field and sort by that new field.

1 of 1 people found this helpful
• ###### 2. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

Hi Andrew,

Thanks so much!

I did exactly what you said and it still doesnt give me an option to sort by that calculation.  I tried multiplying it by -1 and it still doesnt work.  Any other ideas?

• ###### 3. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

Can you provide some screenshots of your set up? Include all of the pills placed on the view. Thanks

• ###### 4. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

Hi Andrew,

I've been playing and I got it to work but only is ascending order. It wont let me do descending order.  Any thoughts?

• ###### 5. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

Yes, multiply it by -1. Create a new calculated field to sort, [CurrentField] * -1. This way of sorting only allows ascending...hence why the value needs to be multiplied by -1, reversing the order.

1 of 1 people found this helpful
• ###### 6. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

That's what the -1 is for.  Create a second calc like this:

1 of 1 people found this helpful
• ###### 7. Re: Sorting Dimensions by Calculated Fields That Use Table Calculations

I had the -1 in and it wasnt re-ordering, but I realized I still had the original table calc + the one * -1 and when I removed the original, it worked! Thanks all!

1 of 1 people found this helpful