Hi all,

I am looking for a pattern in a sequential numbers which is true based on some conditions, for now I used the LOOKUP function and it works but slowly due to the function and code.

I created a calculated field "4 period" as

if sum([Growth dummy > x%])=1

and LOOKUP(sum([Growth dummy > x%]),-1)==1

and LOOKUP(sum([Growth dummy > x%]),-2)==1

and LOOKUP(sum([Growth dummy > x%]),-3)==1

then 1 else 0

end

- Is there a better way of doing this by using previous_value function or some other function?

- How can we do loop in a calculated field? For example, I have a parameter, can I code like this?

for i=1(1)parameter {

if LOOKUP(sum([Growth dummy > x%]),-i)==1 then 1 else 0

}

Many thanks,

Minh

This content has been marked as final.
Show 0 replies

Create your Account

Become a Viz Whiz on the Forums!

Support the Community and master Tableau.