简体   繁体   中英

Tableau using field quarterly record with monthly data

My goal is to create a monthly employment data series given that each record has the following fields: year, quarter, and 3 monthly fields of the actual data (month 1 employment, month 2 employment, and month 3 employment). I have to associate each month of data to an actual month (eg, month 2 of quarter 3 in 2018 as employment for August 2018). Each record represents a firm. A firm will have records associated with each month. So, looking for total employment. There are multiple quarters and multiple years. Would I have to restructure the data or create a calculation? Any suggestions?

This can be done using 'calculated field' easily. Assuming your three fields are year , quarter and month respectively, you can create my_month as follows.

sample data input

year, quarter, month
2018, 1, 1
2018, 2, 1
2019, 4, 3

calculated field my_date as

MAKEDATE([Year], ([Quarter]-1)*3+[Month], 1)

输出

Thereafter add calculated field Total_emp_each_month as

{
Fixed [my_date] : sum([employment])
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM