How to create Tree chart in Apache Superset

27 Views Asked by At

I am traying to create a tree chart showing all departments under different companies.

I tried following code.

SELECT 
  
  c.company_name AS cmp,
  d.department AS dept
FROM 
  _companies c 
LEFT JOIN 
  _departments d ON c.id = d.company_id
where c.company_name is not null and c.company_name <> ''
and d.department is not null and d.department <> ''


UNION

SELECT 
  
  'Company' AS cmp,
   c.company_name AS dept
FROM 
  _companies c 
LEFT JOIN 
  _departments d ON c.id = d.company_id
where c.company_name is not null and c.company_name <> ''
and d.department is not null and d.department <> ''

And this is how placed columns while creating tree chart. Click on the image to view. --> Column distribution

0

There are 0 best solutions below