1
votes

i have this tableau workbook enter image description here

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

enter image description here

new picture

enter image description here

1
Do you want max of datediff values for each user. In other words do you want what was the maximum time taken by each user for placing their next order?AnilGoyal
yes, the point is, the numbers who appear on that pict was counted and find out where the max number are18Man
no its not for each users, but all of the users,18Man
can you show me if the details in your createdat field is that date/time type? If time isn't needed why not change its data type instead to 'date' only? I think that will solve many of your problemsAnilGoyal
I think I have understood your problem, can you please post link of your workbook?AnilGoyal

1 Answers

2
votes

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)

enter image description here

table calculation options on second field (rank_unique)

enter image description here

I have added third field on colors

enter image description here

enter image description here

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