1 of 1 people found this helpful
What happens if you put a negative at the beginning of your calculated field (to negate the values).
Does it sort in the correct order then?
Thanks, but this doesn't work. I essentially have everything already up to the Sort order step. Which is really what @Derrick Austin suggested when he said to negate the value. The problem is that my Sort By is a mix of string and floats, so I am making everything a string via str(). It seems that a str(negative) is treated the same as str(positive) as nothing changes. Any other suggestions?
3 of 3 people found this helpful
I'm sorry if I missed it, but are you using the ASCII() conversion method?
(described in Step 3 and 4 of the "Enhanced Version" towards the bottom of this link:
After ASCII conversion, you should be able to add ascending/descending.
I've used it before:
Thanks, I tried this but ran into an issue. If I am doing the ASCII correctly, Bartley comes before Andrew which is wrong since Andrew should be sorted before Bartley. I used the method in the link you posted, but I went to 10,000 rather than 1,000 i.e. for Bartley, it's 66 * 10000 + 97 * 1000 + 114 * 100 + 116 * 10 + 108 = 769668.
Name ASCII_1 ASCII_2 ASCII_3 ASCII_4 ASCII_5 Final Bartley 66 97 114 116 108 769,668 Andrew 65 110 100 114 101 771,241 Darin 68 97 114 105 110 789,560
Regardless, thanks for the links. For now, I can use the very first letter, but it'd be nice to have a concrete method of sorting this.
I think it may improve if you play around with the weightings.
You can maybe weight the first character heavier:
Andrew 662,114 Bartley 670,956 Darin 690,945
I am trying to sort on a calculated field that is a measure by other measure columns. I have "Company" field which is a dimension and I am calculating the top 15 "Comapny" based on Index value calculated field . The calculated field " Indicator Value" gives the top 15 "Options" and the rest as "Others".
I want to sort the "Indicator Value" based on different measure values like Active weight, TE, TE% and Beta. My original requirement is to be able to sort the "Indicator Value " based on other measures. But not able to do so as it's showing me only "Sort by Data Source Order" or "Manual". I am not able to see the "sort by field option". I think it's because it's a measure.
I came across this post Business AnalyticsCreate a dynamic sort in Tableau and thought of a possible work around.
I created two parameters as "Sort by" which contains Te, Te% etc.and Sort Order " and then linked them to the calculated field " Sort by Field" which would sort all the measures. Instead of sorting on "Indicator Value" , I tried to apply this dynamic sorting on to "Company" pill as "Company" and "Indicator Value" give the same results. While sorting on company pill also I was not able to see the " Sorts by Field" calculated field as option.
Here is the attached screenshot of what I am exactly seeing and trying to do.
Any helps would be greatly appreciated ! I stuck and don't know how to make this work.
1 of 1 people found this helpful
Have you tried putting the 'Sort By Field' as a discrete measure as the first pill on your Rows shelf? This should force the sorting and you would uncheck 'show header' so it's not visible. This technique often works to force a sort, however you have a lot of table calculations happening so it's a bit less clear if this will work in this situation.
Yes, I tried putting the "Sort by Field" as the first pill but no success with the sorting.
Thanks for the suggestion. IS there any possible work around? I have tried this for the last 2 days but couldn't figure out how to make it work.
Any helps would be much appreciated !
Probably better to raise a new thread for this so more people will look at it. I'm not able to download the twbx file at the moment but with a new thread I expect someone else will take a look at it.
Sent from Samsung Mobile