Tableau - Conditions on LOD Expression -
i have purchase_log table has following fields:
uid, date, category, amount
and know first , second purchases dates each user of each category.
for example:
+-----+------+----------+--------+ | uid | date | category | amount | +-----+------+----------+--------+ | | d1 | c1 | 100 | | | d2 | c2 | 200 | | | d3 | c1 | 120 | | | d4 | c2 | 300 | +-----+------+----------+--------+
for above user records, first purchase category c1 made on date d1, , second purchase category c1 made on date d3.
i created 3 calculated fields:
1st purchase:
{ fixed [uid] : min([date])}
repeat purchase:
iif([date]>[1st purchase],[date],null)
2nd purchase:
{ fixed [uid] : min([repeat purchase])}
but since there no distinction between categories, i'm not able see dates respect categories.
how should solve problem?
thanks.
you can loding on both uid , category.
1st purchase:
{ fixed [uid],[category] : min([date])}
repeat purchase:
{ fixed [uid],[category]: iif([date]>[1st purchase],[date],null)}
2nd purchase:
{ fixed [uid],[category] : min([repeat purchase])}
Comments
Post a Comment