so i'm trying make interactive tableau dashboard. problem 2 of tables have repeating values don't join in nice way (many many relationship creates dups)
here raw data in 3 tables:
employee info -
+-----------+--------+--------+ | last_name | salary | tenure | +-----------+--------+--------+ | hoinski | 40000 | 2 | | smith | 90000 | 4 | | jones | 120000 | 10 | +-----------+--------+--------+
employee status -
+-----------+---------+----------+ | last name | status | date | +-----------+---------+----------+ | jones | on time | 1/1/2015 | | jones | on time | 1/2/2015 | | jones | on time | 1/3/2015 | | jones | on time | 1/4/2015 | | jones | missing | 1/5/2015 | | hoinski | on time | 1/6/2015 | | hoinski | late | 1/7/2015 | | hoinski | late | 1/8/2015 | | hoinski | missing | 1/9/2015 | +-----------+---------+----------+
employee risk -
+-----------+--------+-----------+ | last name | risk | date | +-----------+--------+-----------+ | jones | high | 2/10/2014 | | jones | high | 2/11/2014 | | jones | low | 2/12/2014 | | jones | medium | 2/13/2014 | | jones | medium | 2/14/2014 | | jones | medium | 2/15/2014 | | jones | medium | 2/16/2014 | | smith | low | 2/17/2014 | | smith | medium | 2/18/2014 | | smith | medium | 2/19/2014 | | smith | medium | 2/20/2014 | | hoinski | high | 2/21/2014 | | hoinski | high | 2/22/2014 | | hoinski | low | 2/23/2014 | +-----------+--------+-----------+
so joining info table status easy, , joining info risk easy. how can join risk , status? need join them? want build 3 charts interact each other picture:
problem when click on 1 pie chart, can't other pie chart update. going wrong?
i suspect/hope risk , status tables each have row every date every employee, , info table has single row each employee:
+-----------+--------+--------+ | last_name | salary | tenure | +-----------+--------+--------+ | hoinski | 40000 | 2 | | smith | 90000 | 4 | | jones | 120000 | 10 | +-----------+--------+--------+ +-----------+---------+----------+ | last name | status | date | +-----------+---------+----------+ | jones | on time | 1/1/2015 | | hoinski | on time | 1/1/2015 | | jones | on time | 1/2/2015 | | hoinski | late | 1/2/2015 | | jones | on time | 1/3/2015 | | hoinski | late | 1/3/2015 | | jones | on time | 1/4/2015 | | hoinski | missing | 1/4/2015 | +-----------+---------+----------+ +-----------+--------+----------+ | last name | risk | date | +-----------+--------+----------+ | jones | high | 1/1/2015 | | smith | low | 1/1/2015 | | hoinski | high | 1/1/2015 | | jones | high | 1/2/2015 | | smith | medium | 1/2/2015 | | hoinski | high | 1/2/2015 | | jones | low | 1/3/2015 | | smith | medium | 1/3/2015 | | hoinski | low | 1/3/2015 | | jones | medium | 1/4/2015 | | smith | medium | 1/4/2015 | | hoinski | low | 1/4/2015 | +-----------+--------+----------+
according picture provided, seems you're interested in showing how many days given employee on time (for example), , of days on over time, how many of days risk high (for example)? show relationship between risk , status, we're going have include date in our join. looks might not have every employee in status table, we'll want left join.
select * employee_risk left join employee_status on employee_status.last_name = employee_risk.last_name , employee_status.date = employee_risk.date left_join employee_info on employee_risk.last_name = employee_info.last_name;
we'll end this:
+--------+-----------+--------+---------+--------+--------+ | date | last name | risk | status | salary | tenure | +--------+-----------+--------+---------+--------+--------+ | 1/1/15 | jones | high | on time | 120000 | 10 | | 1/1/15 | smith | low | null | 90000 | 4 | | 1/1/15 | hoinski | high | on time | 40000 | 2 | | 1/2/15 | jones | high | on time | 120000 | 10 | | 1/2/15 | smith | medium | null | 90000 | 4 | | 1/2/15 | hoinski | high | late | 40000 | 2 | | 1/3/15 | jones | low | on time | 120000 | 10 | | 1/3/15 | smith | medium | null | 90000 | 4 | | 1/3/15 | hoinski | low | late | 40000 | 2 | | 1/4/15 | jones | medium | on time | 120000 | 10 | | 1/4/15 | smith | medium | null | 90000 | 4 | | 1/4/15 | hoinski | low | missing | 40000 | 2 | +--------+-----------+--------+---------+--------+--------+
now have record every day every employee, every dimension accounted for. have table of raw, unsummarized data, should able hit use filter on each worksheet filters working properly.
Comments
Post a Comment