rbosnjak commented on issue #30238:
URL: https://github.com/apache/superset/issues/30238#issuecomment-2609570199

   Hello!
   
   I'm dealing with the same issue. While I'm still not able to find out how to 
sort x-axis of bar chart based on some metric, while not showing it on the 
chart, I found a way how to create STRING column from VAR_STRING.
   
   To do this, you should open Edit dataset screen, and select "CALCULATED 
COLUMNS" tab. There you need to enter SQL expression, which will probably be 
just the name of the varchar column you want to  convert.  This will create a 
new column in your dataset, which is marked as String.
   
   I'm attaching 2 screenshots where this beahviour is visible.
   
   
![Image](https://github.com/user-attachments/assets/8934dd34-8f70-4a1d-ae87-368613115d28)
   
   
![Image](https://github.com/user-attachments/assets/3e44937f-8d02-424c-beb9-1a2b9d97b523)
   
   
   Now, Sorting option really appears on the screen, as mentioned in the 
comments above. 
   
   
![Image](https://github.com/user-attachments/assets/516ecd82-983b-4ccf-b8eb-82187e49c5c5)
   
   
![Image](https://github.com/user-attachments/assets/fdfe85e3-f3be-44f4-aec1-09376639bd4c)
   
   The next thing I would like to achieve is custom sorting, based on a column 
which is not shown neither on x-axis or inside bar chart values (metrics 
field). 
   
   In my scenario, I have x-axis which is formed out of dates and 
Identification Numbers of subjects I am analyzing. The date is in the following 
format: `%d.%m.%Y.` - for example `31.12.2024.`. The identification number is 
11 digit number. So in the end I get x-axis value like `31.12.2024. 
12345678901`.
   
   I would want to sort these on x-axis, but based on `YYYY-mm-dd` date format, 
since string sort does not work correctly on my time format. Note that I 
already track some metric for each date-subject, and I cannot add any new 
metric to the barchart to be visible.
   
   
![Image](https://github.com/user-attachments/assets/848eaeb6-d61a-40c2-8868-7c0163c4e553)
   
   Does anyone know how I could achieve this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to