简体   繁体   中英

level of detail expressions cannot contain table calculations or the attr function in Tableau

i have this tableau workbook在此处输入图片说明

basically this calculated day different between each user_id and each transaction for each user_id with this calculation

DATEDIFF('day',LOOKUP(MIN([Created At]),-1), MIN([Created At]))

that pull filters its so filter the conditions of users (We can ignore this)

and date_rante filters its for calculated day different between date range on parameter

with this calculated

lookup(min(([Created At])),0) >= [START_DATE] and 
lookup(min(([Created At])),0) <= [END_DATE]

so from the frequency i want to find out the Max of different day, with this calculated

MAX({FIXED [User Id]:DATEDIFF('day',LOOKUP(MIN([Created At]),-1), MIN([Created At]))})

but it says

level of detail expressions cannot contain table calculations or the attr function

so i used this solution https://kb.tableau.com/articles/howto/finding-the-dimension-member-with-the-highest-measure-value

and from that solution, i applied with my codes into like this

MAX({FIXED [User Id]:DATEDIFF('day',INT(LOOKUP(MIN([Created At]),-1)), INT(MIN([Created At])))})

but it turns to error datediff being called with string,integer,integer

based on @Anil solution, i tried to create it, and idk why the results was like this

在此处输入图片说明

new picture

在此处输入图片说明

Presently, as far as my knowledge of tableau is, tableau doesn't allow to calculate LOD calcs or further aggregations on table calcs. To find the transactions where the user took most/max time (in days) in subsequent order- You can do this workaround..

Let's assume your datediff calc field is named as CF1 . create another calc field lets say CF2 with following calculation

rank_unique([CF1])

EDIT:
Change table calcs on this field similar to CF1 . putting a filter on this field will give you the dates with max(time diff) as shown in screenshot.

table calculation options on first (datediff field)

在此处输入图片说明

table calculation options on second field (rank_unique)

在此处输入图片说明

I have added third field on colors

在此处输入图片说明

在此处输入图片说明

(Please note no field used in filters just to highlight)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM