setdateyearmonth - スクリプトおよびチャート関数
この関数は入力として timestamp と month 、year を取得し、入力で指定された year と month で timestamp を更新します。 .
構文:
SetDateYearMonth
( timestamp, year, month )
戻り値データ型: dual
引数:
引数
timestamp
標準的な Qlik Sense タイムスタンプ (通常、日付のみ)
year
4 桁の年。
month
1 桁または 2 桁の月。
例と結果:
これらの例は、日付書式 DD/MM/YYYY を使用しています。日付書式は、データ ロード スクリプト上部の SET DateFormat ステートメントで指定されています。必要に応じて、書式を変更してください。
スクリプトの例
setdateyearmonth ('29/10/2005', 2013, 3)
'29/03/2013 ' を返します
setdateyearmonth ('29/10/2005 04:26:14',
2013, 3)
'29/03/2013 04:26:14 ' を返します ビジュアライゼーションのタイムスタンプの時間の部分を表示するには、数字の形式を日付に設定し、時間の値を表示する形式について値を選択する必要があります。
アプリにスクリプト例を追加して実行します。結果を表示するには、結果列に含まれている項目をアプリのシートに追加します。
SetYearMonth:
Load *,
SetDateYearMonth(testdates, 2013,3) as NewYearMonth
Inline [
testdates
1/11/2012
10/12/2012
2/1/2013
19/5/2013
15/9/2013
11/12/2013
14/5/2014
13/6/2014
7/7/2014
4/8/2014
];
結果テーブルには、元の日付と、年が 2013 に設定された列が含まれています。
結果テーブル testdates NewYearMonth 1/11/2012 1/3/2013 10/12/2012 10/3/2013 2/1/2012 2/3/2013 19/5/2013 19/3/2013 15/9/2013 15/3/2013 11/12/2013 11/3/2013 14/5/2014 14/3/2013 13/6/2014 13/3/2013 7/7/2014 7/3/2013 4/8/2014 4/3/2013