10 Replies Latest reply on Dec 11, 2017 7:26 PM by arvindgarg

Median should Hide when choosing Filter multiple values

Hi All,

I have Tableau worksheet on Sample Store when I have Line chart which show 3 years data with each line and have Show Filter option Product Category and it has multiple options .I have added Median which should display Median when I choose Single Product Category, If I choose Multiple Product Categories. Median should be Hide/Invisible. Tried various ways but no luck. Please find .Twbx file below along with this post.How to achieve this please

Thanks

Chandra

• 1. Re: Median should Hide when choosing Filter multiple values

Hi Chandra. How do you want the median calculated? Do you want the median for all years combined, or do you want the median for each year?

This calculation should get you started, then you can adjust as necessary:

IF TOTAL(COUNTD([Product Category]))==1 THEN WINDOW_MEDIAN(SUM([Sale])) END

• 2. Re: Median should Hide when choosing Filter multiple values

I have tableau 10.3. So attached workbook has been updated to 10.3

As you see in below screenshots.

I created a data item for median calculation.  Also I added product category filter to context.

Then use new data item for median calc.

if (sum({COUNTD([Product Category])}) = 1 ) then sum([Sale])

end

I hope this solves the issue.

• 3. Re: Median should Hide when choosing Filter multiple values

Hi Brent, where shall I apply this variable

• 4. Re: Median should Hide when choosing Filter multiple values

Thanks Arvind,appreciate your inputs. seems you hit the bulls eyes but when I try to implement it in my local machine(10.1 v) it's not working. Please correct me where I am going wrong

- I have place dimension and measure in rows and columns

- Year column and Product Category in Filter

- Median has been added to the Line chart

- Create 'Count Pro Cat'  formula

if (sum({COUNTD([Product Category])}) = 1 ) then sum([Sale]) end

- Make 'Product Category'  filter as 'Add to Contexts'

- then move 'Count Pro Cat' formula into Tooltip area and drop it in Tooltop and check the single and multiple option

Unfortunately, this thing is not working. I am not sure where I missed it.Wondering have I done anything wrong by any chance please.Appreciate your inputs

Thanks

• 5. Re: Median should Hide when choosing Filter multiple values

Sorry I forgot to include that. You can drag it to Details on the marks card, then you can use that calculation for your reference line.

1 of 1 people found this helpful
• 6. Re: Median should Hide when choosing Filter multiple values

you need to use new data item in median line as well.  Please find attached workbook in tableau 10.1.

Hope this solves the issue.

1 of 1 people found this helpful
• 7. Re: Median should Hide when choosing Filter multiple values

Thanks Arvind, you nailed it. Appreciate your help. Can I email you personally please.

• 8. Re: Median should Hide when choosing Filter multiple values

Glad it worked for you. Sure you may email me.

• 9. Re: Median should Hide when choosing Filter multiple values

Hi Again Arvind,

Thanks, I don't know your email id

Thanks