6 Replies Latest reply on Jan 28, 2013 1:26 PM by Sreejit Narayanan

# Query regarding filters

I am trying to compare the sales figures of different customers in the last five years and I want to show the complete trend in all these years. However, I want to display only those customers that have sales greater than a certain number only in year 2012. The second criteria is that the difference between the sales figures in 2011 and 2012 should be greater than a certain number. Is it possible to do this wth Tableau where you have conditions only for two years but you want to display data for all five years? I would really appreciate any help or advice in this regard. Thanks.

• ###### 1. Re: Query regarding filters

Sreejit,

I've attached a workbook that demonstrates the kind of filter I think you are describing.  It is a conditional filter with a custom calculation.

I created a couple of calculated fields that determine the Sales for 2011 and 2012 receptively.  Then I filtered Customer using a calculation that implements the logic you described (though I used arbitrary values).  Take a look and let me know if you have any questions or if I misunderstood what you were looking for.  Thanks!

Joshua

• ###### 2. Re: Query regarding filters

This is awesome!! Thank you so much Joshua.

Just another small query. I want to let the user decide on the threshold. Is it possible to have two different sliding bars that we can display in 'Quick Filter' for the threshold of sales in 2012 and difference of sales in the two years?

Sreejit

• ###### 3. Re: Query regarding filters

Sreejit,

Sorry, when I went to answer your second question, I realized that I'd made a major mistake on the first answer!  The problem is that I'm allowing any customer with sales prior to 2011 or after 2012 through, regardless of the result of the second part of the logic.  That will teach me to double check my work!

I'm going to take a look and I'm confident there is a good solution.

Joshua

• ###### 4. Re: Query regarding filters

Joshua,

That is fine. I have only five years of data with 2012 being the last one. So I can basically skip the first part of your condition.

I am looking forward to your reponse on getting slider for the threshold though.

Thanks,

Sreejit

• ###### 5. Re: Query regarding filters

Sreejit,

Here's the correction.  It's quite a bit more complex than the first (wrong) attempt.  In order not to affect 2009 and 2010, I removed the filter (because I still want all customers for those years).  Instead, I used some table calculations to determine if a customer should be included for the totals for 2011 and 2012.  If you have any questions on the logic or table calculations, feel free to ask!  (And if anyone else sees an easier way of doing this, I"d love to know...)

As far as getting the slider -- that's much easier.  You can include parameters in a calculation and show the parameter control in the view.  I demonstrated that in the attached workbook too.

Joshua

• ###### 6. Re: Query regarding filters

You made my day Joshua. Thanks a lot.

Cheers,

Sreejit