You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/04/13 12:15:41 UTC

[GitHub] [incubator-superset] deviaji opened a new issue #9518: help needed - Days interval grouping in distributed bar chart

deviaji opened a new issue #9518: help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518
 
 
   Hi all,
   I have a requirement to draw a distribution bar chartin Superset. Its Schema is of customers and product purchase for different purchase dates. In this case, product is not relevant. The schema is like this:
   Customer_name   Purchase_amount   Purchase_date
   A                16500             10-15-2019
   A                1200              3-9-2019
   B                7800              2-25-2020
   B                5300              8-19-2019
   C                12000             5-14-2019
   D                6500              1-19-2020
   In Bar chart, need to show 'day interval' in groups of 30 days in X axis. The 'day interval' means the day difference between today's date and 'Purchase_date'. I tried to create one more column in sql query to find out the 'day interval group' like 0-30, 31-60 etc. Then created the chart. It looks fine. But the ordering is based on the amount. But I want it in  the order of 'day interval'.
   ![Capture15](https://user-images.githubusercontent.com/63591408/79119646-77729180-7dae-11ea-8a04-5e82cf7ef7a9.PNG)
   
   Thanks in advance,
   Sreedevi
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] deviaji commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
deviaji commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-614714200
 
 
   Hi eugeniamz,
   Got the issue of putting '-' in the data and string sorting. But if we change hyphen to dot, then also there is a problem. We won't be able to give 180+.
   Is there any other type of charts that supports this requirement and allow us to group days. I am a newbie to Superset and last month, I got another requirement like this. Then I tried this kind of alternatives and got a workaround. But later on I saw there is an option in Superset to create time series bar chart and it supports my requirement. Then I changed the previous work-around and changed the chart type from bar chart to time series bar chart. Any suggestions?
   Thanks,
   Sreedevi

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] mistercrunch removed a comment on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
mistercrunch removed a comment on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-613234161
 
 
   🏷️ 🗑️ #question

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] deviaji commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
deviaji commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-613843204
 
 
   Thanks eugeniamz for the detailed reply and the effort you spent for this.
   
   I also did the same steps. I also used case when for finding out the interval buckets. Steps 2 and 3 are done in the view itself. The difference between my approach and yours, is in the interval bucket labels. You created the interval buckets like 1- <30 days, 2 - 30-60 days etc. I created like 0-30, 31-60, 61-90, 91-120, 121-150, 151-180, 180+ . I think Superset is correctly ordering your labels since it starts with 1, 2 etc. In my case, it orders like 0-30, 121-150, 151-180, 180+, 31-60, 61-180 . This is the issue. I need it like in the following order itself - 0-30, 31-60, 61-90, 91-120, 121-150, 151-180, 180+ . I tried it by adding the prefix with the labels like 1 - 0-30, 2 - 31-60 etc. Its working , but as per the client, label should not have the prefix numbers. Please give your suggestions.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] eugeniamz commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
eugeniamz commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-614390879
 
 
   In the moment that you add '-' between the numbers it will be considered a String and it will be sorted as String. 
   
   The other option will be to add a '.' instead of '-' so it will still be a number and it will be sorted as such. For example : 
   
   ![image](https://user-images.githubusercontent.com/58375897/79410429-653f5180-7f6e-11ea-8122-2e90689ad6ae.png)
   
   Make sense? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] mistercrunch commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-613234161
 
 
   🏷️ 🗑️ #question

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] mistercrunch commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-613234311
 
 
   🏷️ bug

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] eugeniamz commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
eugeniamz commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-612943099
 
 
   In the customize tab you have an option to sort based on the series.
    
   ![image](https://user-images.githubusercontent.com/58375897/79131480-aec54c00-7d76-11ea-82d0-ed178eaea2df.png)
   However you have to have the intervals sorted. In my example you can see that I add 1-<30 days, 2-30-60 days, etc. 
   
   I am not sure how you did the interval section. In my example : 
   1- I took your data and loaded in a table 
   ```sql
   CREATE TABLE sales_test (
   	customer VARCHAR(10)
   	,ammount NUMERIC(9, 2)
   	,sales_date DATETIME
   );
   ```
   
   2- I created a view at the top of the table to calculate the interval with Sysdate() so it is updated 
   ```sql 
   CREATE VIEW sales_test_interval AS
   SELECT *
   	,datediff('day', sales_date, sysdate()) AS sales_interval
   FROM sales_test;
   ```
   3- I use Calculated fields in superset to put the interval in 'buckets' 
   
   
   ![image](https://user-images.githubusercontent.com/58375897/79131888-56427e80-7d77-11ea-9494-328120798f5d.png)
   
   It is just a case statement that most query engine accept
   ```sql
   CASE 
   		WHEN sales_interval <= 30
   			THEN '1- < 30 Days'
   		WHEN sales_interval BETWEEN 31
   				AND 60
   			THEN '2- 30-60 days'
   		WHEN sales_interval BETWEEN 61
   				AND 180
   			THEN '3- 60-180 days'
   		WHEN sales_interval > 180
   			THEN '4-More 180 Days'
   END 
   ```
   HTH. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] mistercrunch removed a comment on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
mistercrunch removed a comment on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-613234311
 
 
   🏷️ bug

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] eugeniamz commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
eugeniamz commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-612945400
 
 
   Note: that you could had done step 2 and 3 in just one step in the DB view or in Superset Calculated field.  

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] deviaji commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
deviaji commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-614717033
 
 
   Also the requirement is done in Microsoft excel by client. Sorting is working fine in charts created in excel sheet. So he believes there is a similar straight forward option in Superset.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] mistercrunch commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9518: Help needed - Days interval grouping in distributed bar chart
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-613234000
 
 
   🗑️🏷️ #question

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] commented on issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #9518:
URL: https://github.com/apache/incubator-superset/issues/9518#issuecomment-645132719


   This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue `.pinned` to prevent stale bot from closing the issue.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] closed issue #9518: Help needed - Days interval grouping in distributed bar chart

Posted by GitBox <gi...@apache.org>.
stale[bot] closed issue #9518:
URL: https://github.com/apache/incubator-superset/issues/9518


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org