組合動作/劇本你好,
我想做一個表格,製作成數據表,然後根據數據表添加計算指標。 以下是我現在所擁有的(複製每個操作的腳本)。 我不確定如何將數據表的操作和新指標結合起來。 請幫忙,先謝謝了!
dt = Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns(
:Name( "201733 Weekly COMP Store Sales" ),
:Name( "201833 Weekly COMP Store Sales" )
)
),
Row Table(
Grouping Columns( :Name( "18 IRI Market" ) ),
Add Aggregate Statistics( :Name( "18 IRI Market" ) )
)
)
);
dt << makeintodatatable;
dt << New Column( "ratio",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( :Name( "Sum(201833 Weekly COMP Store Sales)" ) / :Name( "Sum(201733 Weekly COMP Store Sales)" ) ),
Set Selected
);回覆:合併動作/劇本嘗試 Summarize()。另外,您可以向製表平台添加“不可見”參數,這樣您就永遠看不到實際顯示...
回覆:合併動作/劇本簡單的問題:JSL 中是否有 Groupby 函數(如 Python 中)來取代 tabulate 函數?
回覆:合併動作/劇本非常感謝吉姆!
是的,這正是我所需要的。 在 tabulate 產生的新資料表之上新增計算指標。 多謝!回覆:合併動作/劇本請參閱下面我對腳本的更改中的評論
dt = current data table();
// dt normally is a reference to a data table, as I have referenced
// in the statement above. The variable "tab", below, will refer to the
// tabulate platform
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns(
:Name( "201733 Weekly COMP Store Sales" ),
:Name( "201833 Weekly COMP Store Sales" )
)
),
Row Table(
Grouping Columns( :Name( "18 IRI Market" ) ),
Add Aggregate Statistics( :Name( "18 IRI Market" ) )
)
)
);
// the dt2 variable will point to the new output data table
dt2 = tab << makeintodatatable;
// I am a little confused as to what data table you really want to
// add the new column to......I am changing the dt data tablereference
// to dt2, it is in the output data table that thes columns exist
dt2 << New Column( "ratio",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
:Name( "Sum(201833 Weekly COMP Store Sales)" ) /
:Name( "Sum(201733 Weekly COMP Store Sales)" )
),
Set Selected
);