3

I'd like to change the query so that the metrics / labels are different. So instead of the chart saying "sum_sum_girls", it would say something like "Total Girls" instead.

Current query is as follows:

 SELECT state AS state,
       SUM(sum_girls) AS sum__sum_girls
FROM birth_names
WHERE ds >= '1918-05-11 00:00:00.000000'
  AND ds <= '2018-05-11 18:03:20.000000'
  AND state NOT IN ('other')
GROUP BY state
ORDER BY sum__sum_girls DESC
LIMIT 50000
OFFSET 0;`enter code here`

I'd like to change it so it says

  SELECT state AS state,
       SUM(sum_girls) AS Total_Girls
FROM birth_names
WHERE ds >= '1918-05-11 00:00:00.000000'
  AND ds <= '2018-05-11 18:03:20.000000'
  AND state NOT IN ('other')
GROUP BY state
ORDER BY sum__sum_girls DESC
LIMIT 50000
OFFSET 0;

Any advice? Tried Googling to no avail. I'm used to being able to create easy custom SQL queries in Tableau.

David Shinabarger
  • 143
  • 1
  • 3
  • 12

3 Answers3

3

You should be able to create custom queries by navigating to 'SQL Lab' > 'SQL Editor'.

You should then be able to create queries and re-use them in your graph.

See "Creating Datasources Using SQL Lab" on https://duperset.com/getting_started

David Tobiano
  • 1,188
  • 8
  • 10
  • 1
    But custom queries does not reflect on the Interface with all required columns when you try to create line/bar charts – Volatil3 Nov 12 '19 at 11:44
1

Not sure if this is what you are looking for, but I'm gonna try.
For a chart you can define a Verbose Name for any metric you have. This is going to be the name displayed as a legend to the chart.
To do so, please go to the Datasuource(sometimes it is also called Table) you use for the chart and there to the List Metrics tab.

dmigo
  • 2,849
  • 4
  • 41
  • 62
1

Go to Edit Datasource and in tab Metrics define metrics and its labels which will be shown in the chart.

enter image description here

Another approach is to define it directly in chart like in the picture below:

enter image description here