
1. Re: Sorting based on calculated field (percentage)
Andrew Watson Aug 1, 2012 7:28 AM (in response to thierryjakircevic)Can you not sort the Country by using the % calculated field?
Right click on the Country pill and click Sort. In the Sort options there is a choice to Sort by Field. Choose the % calculated field and that should sort how you want. Hopefully I'm not oversimplifying things...
Andrew

2. Re: Sorting based on calculated field (percentage)
Shawn Wallwork Aug 1, 2012 8:04 AM (in response to thierryjakircevic)Thierry,
If you put the Country dimension to the left of the IsUnknownVehichles measure (?), then do what Andrew mentioned, the sort should work. If you leave the dimension to the right of the measure it won't sort at all, as you've discovered. I've attached a Superstore sample.
Shawn

Sort Problem.twbx.zip 1.1 MB


3. Re: Sorting based on calculated field (percentage)
thierryjakircevic Aug 1, 2012 6:08 PM (in response to thierryjakircevic)Thank you Shawn and Andrew for helping out. The problem with my view is that I cannot use the field "Number of Records" as my sorting field.
Please see below the full view. I am displaying hidden data and header and also added a "Number of Records" to illustrate my point.
What I want to do is to sort the "Countries" based on their respective percetange of "Known" values.
Since that percentage is calculated as a ratio between known and unknown within each country, I cannot use the field "Number of Records" in my sorting field.
I should also probably have mentioned more clearly that this "% measure" is not a "calculated field" per se but rather a "Quick Table calculation" based on the measure "Number of Records" expressed a "Percent of Total" computed using the field "IsUnknownVehicles" as shown below:
Sorry if my original post led to confusion. I hope the above makes sense. I'm sure I am missing the point somewhere but really can't figure it out. Thank you for your help.
Thierry

4. Re: Sorting based on Quick Table Calculation (Percent of Total)
thierryjakircevic Aug 7, 2012 6:28 PM (in response to thierryjakircevic)Hi All. Could someone be kind enough to help? This issue is driving me nuts...
Thanks a lot!

5. Re: Sorting based on Quick Table Calculation (Percent of Total)
Tim Lens Aug 9, 2012 12:42 PM (in response to thierryjakircevic)Hi Thierry
You'll need to single out the 'Known' ones to be able to sort on it.
See the attached workbook (pretend that prod category is your known/unknown ones)
* sheet 1: everything sorted on furniture % (could be your known %) > see calculation1
* sheet 2: dynamic with parameter > see calculation2Hope that helps

6. Re: Sorting based on Quick Table Calculation (Percent of Total)
thierryjakircevic Aug 9, 2012 6:00 PM (in response to Tim Lens)Hi Tim,
Thank you for helping out. Unfortunately, my issue is different.
Taking your format as an example, I would like to be able to sort in ascending order the list of STATES based on % value of FURNITURES (for instance).
As you can see the screenshot below is sorting the list of STATES based on the NUMBER OF RECORDS. But what I need is to sort them based on the "% OF TOTAL NUMBER OF RECORDS".
If I click on the small sort button that appears when I hover on the horizontal axis, the sorting works. See below:
The problem is that such sorting is based on the % values at the time. When the database is updated, it won't automatically sort my view again.
Thank you

7. Re: Sorting based on Quick Table Calculation (Percent of Total)
thierryjakircevic Oct 5, 2012 4:28 AM (in response to thierryjakircevic)This issue is really driving me crazy.
Would really appreciate if someone could help me solving this...
THierry

8. Re: Sorting based on Quick Table Calculation (Percent of Total)
Russell Christopher Oct 5, 2012 5:08 AM (in response to thierryjakircevic)1 of 1 people found this helpfulI'm just about to run out of the door so can't play with this as much as I'd like, but here's the approach I'd take:
 Make a copy of your Table Calc (Sum([Number of Rows]))
 Convert it to Discrete
 Drop it in front of [State], where it will forcesort the State values
 Hide the headers
The issue I'm seeing is that I'm getting an ascending sort vs. a descending sort...but I have the "auto sort" behavior you're looking for....Will play with this more later in the afternoon (my time) if someone else hasn't figured it out by then:

9. Re: Sorting based on Quick Table Calculation (Percent of Total)
Russell Christopher Oct 5, 2012 12:54 PM (in response to thierryjakircevic)1 of 1 people found this helpfulOK  Got it. See attached.

10. Re: Sorting based on Quick Table Calculation (Percent of Total)
thierryjakircevic Oct 5, 2012 4:41 PM (in response to Russell Christopher)Thanks a lot for helping out Russell.
Do I really need to use a parameter to make this work? I have a lot of views (using different dimensions) for which I would require this auto sorting and that would be a real pain to implement it everywhere. Also, I anticipate that the non dynamic nature of parameters may create issues.
Your first suggestion (duplicate calculcated field and converting it to discrete) is a nice and quick workaround but as you pointed out it will sort in ascending order. Any way to change it to descending order while keeping it as simple?
Thierry

11. Re: Sorting based on Quick Table Calculation (Percent of Total)
Russell Christopher Oct 7, 2012 3:43 PM (in response to thierryjakircevic)2 of 2 people found this helpfulYeah  the sample I attached earlier demonstrates same. Just change the expression in the discrete calculated field to [whatever the expression was, I forgot] to ([whatever the expression was, I forgot] * 1 )
Hackolicious, but it works.

12. Re: Sorting based on Quick Table Calculation (Percent of Total)
thierryjakircevic Oct 7, 2012 11:26 PM (in response to Russell Christopher)Thank you Russel! Hope Tableau 8 will bring the ability to set this kind of sorting by default