问题
Using Tableau, I have arranged some data in a 100.00% stacked bar:
I want to sort the data descending (largest to smallest) by Valid component type
(green) - is this possbile?
UPDATE (26th July 2017)
merawalaid's answer ALMOST worked; I followed the steps, adjusted the code to match my specific project, and it resulted in this:
As you can see, it is somewhat sorted, but not quite as it should be (for example, the fourth and sixth rows are featured too high in the chart.
Is there something that might be wrong that I have missed here?
回答1:
I was able to do this: You can download my workbook here. Be advised though, I feel there would probably be a simpler way out there to do this.
What I did was to create 2 calculated fields.
'ValidComponentCount': IF ([Component Type]='Valid Component') THEN 1 ELSE 0 END
'% of Valid': {FIXED [Rootname] : SUM([validCount])/COUNT([Number of Records])}
Then sorted the 'Rootname' column based on descending value of the 2nd calculated field (% of Valid).
来源:https://stackoverflow.com/questions/45306339/it-is-possible-to-sort-by-valid-percentage-in-my-data