4 Replies Latest reply on Aug 25, 2018 10:11 AM by Srikanth Goli

# Value Based on Filter Selection

Hi Everone,

I am having some trouble trying to accomplish some basic calculation with Tableau so thought of leveraging the team's expertise.

So I am trying to calculate avg based on the number of days selected by users in date filter. If you see the below image, user selected 6 days so I want a new column which divides the Furniture profit 74.2/6 = 12.3, 580/6, and so on. It should not consider whether there is data present in that aggregation level or not.

My scenario is a bit more complicated but I drilled down to this simple scenario to get started since I cannot share confidential data outside.

Tableau Desktop Version: 10.5 and workbook attached.

Screen:

Best,

Srikanth

• ###### 1. Re: Value Based on Filter Selection

Srikanth,

Make calculated field: Profit Per Day:

SUM([Profit])/SUM({EXCLUDE [Category]:COUNTD([date])})

You will get it. Hope it helps.

Michael Ye

4 of 4 people found this helpful
• ###### 2. Re: Value Based on Filter Selection

Hi Srikanth,

1) Create a calculated field like below

2) Add the filter to the context

3) Create a calculated field named profit/Unique_date

4) Drag the fields in the measure value shelf you will get the view like below

Hope this helps

Plz Mark it helpful and correct so that it will help others and as well to close the thread

BR,
NB

3 of 3 people found this helpful
• ###### 3. Re: Value Based on Filter Selection

Hi Michael,

Perfect! This is what I am looking for. Thanks a lot.

Thanks,

Srikanth

• ###### 4. Re: Value Based on Filter Selection

Hi Naveen,

Thanks for the reply. This works as well.

my other calculations are similar to the one Michael mentioned so I noted it as the correct answer. Thanks for your input.

Best,

Srikanth