Start a new topic

Chart: Add support to plot serie(s) by a grouping column

I use the chart feature to visualise data quite extensively, I love that feature to graph my data in a simple way!

To graph and compare multiple series in same graph is often quite frustrating since the queries must be crafted so each serie is in its own column. My queries often ends up looking something like this:

select

  r.date,

  sum(case when market = 'SE' then 1 else 0 end) as reqs_se,

  sum(case when market = 'FI' then 1 else 0 end) as reqs_fi,

  sum(case when market = 'NO' then 1 else 0 endas reqs_no,

  sum(case when market = 'DK' then 1 else 0 endas reqs_dk

from

  Requests r

group by 1 order by 1

;


The result can then be plotted and compared by market in chart with "date" column selected as "Category" and "reqs_se", "reqs_fi" and "reqs_no" ticked in the "Series" dropdown.


A much more convenient and elegant way to simplify the above would be if you could add two additional and optional dropdowns: "Grouping" and "Groups". In the "Grouping" dropdown you can optionally select a column to group the data by and in the "Groups" dropdown you then select the groups to show in chart.

With this new killer feature the query above would look like this:


select

  r.date,

  r.market,

  count(*) as reqs

from

  Requests r

group by 1,2 order by 1,2

;


And I can then e.g. plot and compare the requests in SE and NO market by selecting the date column in the "Category" dropdown, select "reqs" column in the "Series" dropdown, select "market" column in the "Grouping" drop down and then tick the SE and NO markets in the "Groups" drop down.


The above example is very simplistic. My queries easily gets over 100 lines long if I e.g. have 20 different markets and e.g. 5 different kpis to compare. That query would with this feature only be at most 10 lines long without any bulky case expressions.


I would gladly renew my dbvis license the day this feature is implemented.



Login or Signup to post a comment