sql server - creating summation in a sql table in SSIS for Tableau -


i want sum hours daily dates month in ssis package. wrote following sql code this:

the below query calculates sum of forecasthoursend , groups date month

select year(forecastdate) y, month(forecastdate) m,sum(forecasthrsend) p rpt_histsnapeng group year(forecastdate), month(forecastdate) 

and, below query calculates sum of actual hours , groups date month

select year(actualsdate) y, month(actualsdate) m, sum(actualhrs) p rpt_histsnapeng group year(actualsdate), month(actualsdate) 

now trying write code in ssis pass them variable/column can use column in tableau create chart, how that?

i referencing following links purpose:

sql needed: sum on values month , sql query sum-up amounts month/year

first, there no reason @ can't use tableau perform aggregations @ year , month grain - without having pre-aggregate data.

however, if insist on preparing data in sql first, have couple of options:

1. union

this more normalized structure allow use t ("type") in measure separate/delineate data.

select     year(forecastdate) y,     month(forcastdate) m,     'forecast' t,     sum(forecasthrsend) p     rpt_histsnapeng group     year(forecastdate),     month(forcastdate)  union  select     year(actualsdate) y,     month(actualsdate) m,     'actual' t,     sum(actualhrs) p     rpt_histsnapeng group     year(actualsdate),     month(actualsdate) 

2. basic

this denormalized , closer existing table structure. tableau can handle design nicely, well, using measures (hours) dual axes.

select     year(forecastdate) forecast_year,     month(forcastdate) forecast_month,     year(actualsdate) actual_year,     month(actualsdate) actual_month,     sum(forecasthrsend) forecast_hours,     sum(actualhrs) actual_hours     rpt_histsnapeng group     year(forecastdate),     month(forcastdate),     year(actualsdate),     month(actualsdate) 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -