简体   繁体   English

Tableau 使用带有月度数据的字段季度记录

[英]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).我的目标是创建一个月度就业数据系列,因为每个记录都有以下字段:实际数据的年、季度和 3 个月度字段(第 1 个月的就业、第 2 个月的就业和第 3 个月的就业)。 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).我必须将每个月的数据与实际月份相关联(例如,2018 年第 3 季度的第 2 个月作为 2018 年 8 月的就业)。 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.假设您的三个字段分别是yearquartermonth ,您可以按如下方式创建my_month

sample data input样本数据输入

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

calculated field my_date as计算字段my_date

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

输出

Thereafter add calculated field Total_emp_each_month as此后添加计算字段Total_emp_each_month作为

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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