1 2 Previous Next 24 Replies Latest reply on Aug 9, 2019 2:15 AM by Lena Boehnke

# How to show a diagram only if the n is bigger 5 f.i.?

Hi everybody,

my problem is, that let's say we have a bar chart with sales by regionand my total number is without filtering 100. Now i want, that my total diagram is only shown if the number of cases is bigger 5, otherwiese nothing should be shown  (so if i use a lot of filters like category for example). Background is, that i want to maintain the anonomity of each person if i give the data/story to other people.

Is and how is it possible to mask out the whole chart if the number of cases is too small?

I would be so thanksful if you can help me

Tobi

• ###### 1. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi Tobias,

Could you please share the workbook with sample data to understand your requirement clearly.

Thanks & Regards,

Ravikiran S

• ###### 2. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi Tobias,

Could you please share the workbook in 2018.3 format to resolve your issue.

Thanks!

Sankar M

• ###### 3. Re: How to show a diagram only if the n is bigger 5 f.i.?

I can only provide a screenshot of the sheet/dashboard, as these are sensibel data and I also think that it's a general thing, the only specifal thing may be that these are market research data. (The data is not dynamic, the number of figures won't change )

Right here I don't filter anything. When i use now filtern and the n may get lower and lower, my aim is, that if the n is smaller than 5, I don't want to see anything (even if there are answers available). I hope I explained it understandable, otherwise don't hasitate to ask .

Tobi

• ###### 4. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi Tobi,

Can you mock something up using the Superstore data set?  I'm getting a little confused your use of n and how it relates to the bar charts since the percentage relationship and what is being filtered isn't clear.

I've attached a packaged workbook that is using the superstore data with a bar chart showing a few days of sales broken out by region.  Can you adjust, etc. to make it work as a proxy for your data and question?

Thank you,

John

• ###### 5. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hey John,

my data is structured in a different way than in the superstore file and you may also have to think in a bit different way than you normally use Tableau. The reason is because the data comes from a survey and thats why in this survey, let's say 100 people took part ( and yes, I know that it's not special to use Tableau for such a case, but however ). Now like you can see I habe three filters, and if I filter "too much"  it would be possible to see (indirectly) the answer of a single person and than the answers would not be anonym anymore. The n varies depending on the filters

Hope this information helped again . But it's really great that you are try to find a solution for me, really appreciate it.

Tobi

• ###### 6. Re: How to show a diagram only if the n is bigger 5 f.i.?

In these kinds of cases, you can't use the raw columns to create your viz.  You have to create calculated fields that check for the value of "n" and then display or not display a value based on the results of that test.

In pseudo-code, something like

IF n>=5

THEN <show my percentage>

ELSE 0

END

Ganz klar?

• ###### 7. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi Tobi,

Is N the total number of responses or is it the total number of unique IDs with a given response?

• ###### 8. Re: How to show a diagram only if the n is bigger 5 f.i.?

As an example:

You've got this chart:

If I set N to 20, should the WHOLE CHART be blank or only South?

• ###### 9. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi again,

in this case it is the number of unique IDs, so I used COUNTD and not COUNT. But both cases are relevant for me, how to hide the chart depending on the number of cases.

• ###### 10. Re: How to show a diagram only if the n is bigger 5 f.i.?

The whole chart should be blank

• ###### 11. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi Michael,

we nearly did it, but I would like to have it a little bit different. With your formular, people can't see the values of a answer option of the question if these are lower than 5.  It looks like this now, on the left is the original diagram and on the right with your formular (note: this is a multiple answer set, so the question was something like "Which are your top 3 ....)

Now i would like to have ALL values of the answer options if the number of cases is bigger than 5, but if it's smaller, than that the whole diagram should be blank. Also quite difficult for me to explain, but I'm confident that it is possible. Let me know if it wasn't clear enough

• ###### 12. Re: How to show a diagram only if the n is bigger 5 f.i.?

No, that's clear.  You just need to set it up right.  Very hard to help without your actual workbook, because we don't know how your data is configured.

Are each one of those bars an independent calculation, or are they a single calculation partitioned by ANSWER?  What is on your ROW and COLUMN shelves?

You need to make sure that whatever is calculating each individual bar is checking to see what the value of "n" is to determine if you should display it or not.  What I gave you was a conceptual framework, not a literal interpretation of what is needed with your specific dataset.

• ###### 13. Re: How to show a diagram only if the n is bigger 5 f.i.?

They aren't calculated independently, it's a single calculation.

For the left chart I have in Column " COUNTD([question])" and for the right one" IF COUNTD([question]) >5 THEN COUNTD([question]) ELSE 0 END. In the row I only have a dimension called "text response" which shows all the response options.

I think we need to find something like a "meta calculation", so it's not depending on the single response option wheater on the n of the whole question. But still didn't find a solution yet...

• ###### 14. Re: How to show a diagram only if the n is bigger 5 f.i.?

Hi Tobias,

Total Unique ID in View > n

WINDOW_MIN(COUNTD([Order ID]))>=[N Parameter]

Can you adapt this to work for the layout of your dataset?

Here's how it works in this example:

N=18

N=19