4 Replies Latest reply on May 12, 2013 4:02 PM by Joshua Milligan

# LOOKUP function with 2 parameters

Hi All,

I am facing issue to use LOOKUP function with 2 fields. I need to get last 4 week change % based on week & country parameter. But, It is working properly only with week & week filter as a parameter. If I add country field in report & filter and it is NOT providing result as expected. The reason is that, somehow country data is overlapping. The results should be as below,

For UK:

Wk 10                         = 261

Last 4 week average     = Wk 9 to Wk 6 = 382.75

% Change                    = (261-382.75)/382.75* 100 = -31.80 %

For USA:

Wk 10                         = 500

Last 4 week average     = Wk 9 to Wk 6 = 375

% Change                    = (500-375)/375 * 100 = 33.33 %

Note: If you remove country, Country filter from the report then report result is fine as below.

Wk 10                         = 761

Last 4 week average     = Wk 9 to Wk 6 = 757

% Change                    = (761-757)/757 * 100 = 0.53 %

Anyone have idea how to use LOOKUP with 2 parameters ?

This request is follow-up of - http://community.tableau.com/thread/125924

Best Regards,

Rajini

• ###### 1. Re: LOOKUP function with 2 parameters

Rajini, Brad Llewellyn or Joshua Milligan might be able to get this going for you.

--Shawn

• ###### 2. Re: LOOKUP function with 2 parameters

Rajini,

It looks like you were really close!  I just changed your filters to use the desired fields instead of the parameter.  I did leave them as table calculations as that is required to keep the week data from the source and get the average over multiple weeks.

The calculations looks like: LOOKUP(ATTR(Country), 0)

Also, the other table calculations need to be computed along Week.

Regards,

Joshua

• ###### 3. Re: LOOKUP function with 2 parameters

Thanks Shawn & Joshua. Your suggestion is properly working in my report. Thanks once again.

Best Regards,

Rajini