Hello all, I need support regarding the order of ...
# gooddata-cn
k
Hello all, I need support regarding the order of slices in a donut chart. I have a custom sort field that i created in snowflake that sorts the results of the query based on specific conditions. However, I cannot find a way to sort my donut chart slices to follow that custom sorting. I tried to use the sort by option in the ldm to sort my attribute by the sort field, but that doesn't produce the required results. When i switch to table view and add that sort field to the insight alongside my attribute, the sorting works as expected, but when i remove it, the sorting logic breaks because my custom sort field has a different range based on how the insight is filtered. So it might go up to 40 but for category B it might go up to 45 etc. Thanks in advance for any ideas!
m
Hello, please let us check this internally and we will get back to you as soon as possible with more details.
j
Hi Khedir, can you provide a screenshot of what exactly you are trying to apply in the sorting? Could you clarify how the current button doesn't fit your use case? Also, do I understand correctly that there is a workaround by switching to the table view and then back to the donut chart?
k
Hey Joseph, So the output I'm trying to achieve is to sort all categories by my value (largest to smallest), besides one category, which is cash that should always appear at the end no matter the value. I created a sort field in my query that achieves this and tried to sort my categorical variable by that field in the ldm. In the table view, if i have my categorical variable, my sort field, and the value all in the table, the sorting works as expected. However, when i switch to the donut chart, i obviously can only use two and the sorting logic no longer works.
j
Once you change to donut chart are you able to change the sort order again and get it to the desired results?
Could you possibly share a screenshot of what you are seeing and details showing what you want to see?
k
Sure. So Please find the table view where i have my categorial variable, sort field, and value. As you can see, Cash appears at the end no matter what the value is. In the second screenshot, i sort my Custom Logic Based 4 field by my Logic Based 4 Row Rank field. However, still in the table view, when i remove my sort field from the insight, the sorting breaks and the results seem to duplicate. Im assuming its because the maximum Row Rank for the sort field for any category is 63. so even if this category (Portfolio group MEDOW) has 7 records, we would still see 63 rows. so, if you can please guide me on how to make my custom sort field work without it being needed to be as a row in the insight, i think the pie chart issue would be fixed too.
j
While it is possible to implement a custom sort field under certain conditions, it appears that this may only work effectively in very simplified scenarios. If your custom sort field is an attribute calculated within the SQL dataset using specific logic, you can set it as the "sort by" option for the main attribute in the modeller. This way, you won't need to include any additional columns in your visualization. However, there's an important consideration to keep in mind: if your sorting logic is based on values calculated in the SQL dataset, it's crucial to note that this calculation occurs before any dashboard or visualization filters or aggregations are applied. As a result, the sorting order defined in this manner will be static and will not dynamically respond to any changes made through filters or aggregations in your dashboard.