3 Replies Latest reply on Nov 9, 2015 5:11 AM by Rody Zakovich

# How to find the percentage difference across last 2 weeks for many measure?

How to find the percentage difference across last 2 weeks for many measure?

• ###### 1. Re: How to find the percentage difference across last 2 weeks for many measure?

Hello Ashish,

Can you provide more details on your situation and what you are trying to accomplish?

There are a few ways we could possibly do this, but id depends on what your end goal is.

If you have an example workbook, that would be very helpful.

Getting the Most From the Tableau Forums

Regards,

Rody

• ###### 2. Re: How to find the percentage difference across last 2 weeks for many measure?

I have used this formula :

If attr([Week])=max([Week])

then

(sum(Measure)/LOOKUP(sum(Meaure),-1)-1)

END

and it works

But I have many measures so have to create a calculated field for each measure. Is there a table calculation to to find a % difference for just the last 2 weeks..there are many weeks in the dataset

• ###### 3. Re: How to find the percentage difference across last 2 weeks for many measure?

Hello Ashish,

Unfortunately, you will need to create this calc for each measure.

To get on the difference for the last two weeks, you could change your calc to

If attr([Week])= WINDOW_MAX(max([Week]))

then

(sum(Measure)/LOOKUP(sum(Meaure),-1)-1)

END

If the [Week] is the MAX Week in the viz, then do the Lookup Calc, else return NULL. So you are effectively only getting the Difference for the Last Two Weeks

Regards,

Rody