Doughnut Chart Multiple Columns

Hi,

I am trying to create a simple doughnut chart which uses two columns which can easily be written in SQL as the following

SELECT 'CAR' as 'TYPE', SUM(carCount) as 'Count' from table
UNION ALL
SELECT 'TRUCK' as 'TYPE', SUM(truckCount) as 'Count' from table

I am currently reading from a CSV file. How should I approach this problem, as it currently doesn’t seem possible to use multiple columns in a doughnut/pie chart? I’m having similar issues with other timeseries data.

Hi,
You should create a table with the select statement you would use for the chart

So crate table new_table as select…

The reason because you can’t use it in a view is because we have some limitations on our union all.

Said that if needed you can teacte views in slq editor and then assign as needed for each chart, but doing this you will lose the cross-filtering between charts in the dashboard

Regards,
Candido

Thank you for the reply. If I create a new table from the select, I will lose cross filtering from the originating data source, correct? Ideally I would like to be able to filter across this dataset as with my other charts.

Also, unfortunately, literal columns such as the following, will throw an exception as the string length does not match.

Subqueries of a UNION must have the exact same data types.

CREATE TABLE NEW_TABLE AS (
SELECT 'CAR' as 'TYPE', SUM(carCount) as 'Count' from table
UNION ALL
SELECT 'TRUCK' as 'TYPE', SUM(truckCount) as 'Count' from table
)

A work around for this is to use something like

SELECT 'CAR  ' as 'TYPE'......

Hi,

If you create a table (or a view) for specific charts and you don’t use on other charts you are going to lose the cross-filtering, but If you use the same table (or view that can use more than one table) across all charts of the dashboard, it’s ok.

In the upcoming release, we are going to ease that limitation.
Let me check if it’s possible to do something using parameters or table functions

Scarica Outlook per Android