いつもお世話になっております。田中です。
以下のような購入履歴のデータがあったとします。
custemar_idtransaction_dateitem_id
Item_name
aaa2016-06-01A123プリンaaa2016-06-02B456牛乳bbb2016-06-03B456牛乳ccc2016-06-04A123プリンbbb2016-06-04A123プリン
こちらのデータから、例えば、「プリン」と「牛乳」の両方を購入した人を集計したい場合、どのようにすればよいでしょうか?
この場合、aaa、bbbの人を抜き出して、
「プリンを購入した人は3人、うち、2人は牛乳も購入している」「牛乳を購入した人は2人、うち2人はプリンも購入している」といったことを集計したいと考えています。
4 risposte
Calculated Fieldをいくつか作成します。
LOD と If Statement を組み合わせて、必要なDimensionを作成します。 詳細レベル (LOD) 表現について | Tableau Software
[プリン purchase]
if
{fixed [Custemar Id]:count(if [Item name]="プリン" then [Custemar Id] end)}=1
then "Yes"
else "No"
end
[牛乳 purchase]
if
{fixed [Custemar Id]:countd(if [Item name]="牛乳" then [Custemar Id] end)}=1
then "Yes"
else "No"
end
[Purchase Both]
if [プリン purchase]="Yes" and [牛乳 purchase]="Yes"
then "Purchase Both"
else "Purcahse One"
end
あとは適当に表を作成します。
村上
9.3 attached