LoginSignup
0
0

2023: Week 32 - HR Month - Reshaping Generations/Preppin' Data/Tableau Prep

Last updated at Posted at 2023-08-12

Challenge Preppin'Data 2023:Week 32

概要

世代区分名を生成し、従業員のdate_of_birth(誕生日)から世代区分名を従業員データに付加します。
変換1.PNG

date_of_birth(誕生日)から年代に区分します。
変換2.PNG

問題のページ(英語)※ここからデータをダウンロード

出題者の回答のページ(英語)※動画あり

自分の解決法

preppindata_week32_20230812.PNG

ポイント

年齢の計算

IF DATEADD('year', DATEDIFF('year', [date_of_birth], [month_end_date]), [date_of_birth]) > [month_end_date]
THEN DATEDIFF('year', [date_of_birth], [month_end_date]) -1
ELSE
DATEDIFF('year', [date_of_birth], [month_end_date])
END

年代の計算(5歳刻み)

IF [employee's age] < 20 THEN "Under 20 years"
ELSEIF [employee's age] >=70 THEN "70+ years"
ELSEIF ISNULL([employee's age]) THEN "Not Provided"
ELSE STR(div([employee's age],5) * 5) + "-" + STR(div([employee's age],5) * 5 + 4) + " years"
END

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0