Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Jojki
New Member

Hide the graph when number of the respondents is too low

Hello,

I need help with a PowerBI code issue I've been struggling with for several days, even with the assistance of GPT. I want to send a report to clients but ensure they cannot see data when the number of respondents is less than 6. This means, since I have multiple filters, when the number drops to 6 or fewer, the chart should be hidden so they can't see individual results, only grouped results for a minimum of 6 respondents.

I wrote the following codes, and everything works fine regarding hiding the chart. However, the problem is that when the chart is hidden, the code also hides the values within the chart that are less than 6, even when no filter is applied.

First, I counted the respondents:

 

AnzahlBefragten = COUNTROWS('Frage 6')
Then I created a measure to control the chart display:
Vorschau = IF([AnzahlBefragten] > 6, 1, 0)
 
Additionally, I included a message in the table for low respondent numbers:
Info = IF([AnzahlBefragten] <= 6, "Die Fallzahl ist zu gering für eine valide Interpretation", BLANK())
The issue is that whenever I use this measure in the x-axis, one category with 3 respondents disappears from the chart. How else can I resolve this? Is it possible? I tried everythin, please help.
All the best
Jojki
2 REPLIES 2
Anonymous
Not applicable

Hi @Jojki ,

I'm sorry I didn't understand what problem you were having, especially with these sentences:
'However, the problem is that when the chart is hidden, the code also hides the values within the chart that are less than 6, even when no filter is applied.'
'The issue is that whenever I use this measure in the x-axis, one category with 3 respondents disappears from the chart.'

Could you please explain your problem using a screenshot? And could you please provide the sample data and expected results?

Best Regards,
Dino Tao

Hi Dino Tao,

Thank you for your question. It seems that my explanation was not that good :D. I will try it again. My goal is to hide the whole graph when the number of respondents is less than 6.
With my codes I managed to do this, but with them I also hide the category in the graph that has less than 6. I want to keep all the categories and values when the number of respondents is greater than 6 and hide the whole graph when it is less than 6. The first image shows the situation without codes. I have "-5% to 10%" 3 respondents. The second screenshot shows what happens when I implement the solution with my code. This category "-5%-10%" is no longer there, while less than 6 is. The third solution is what I would like to have, a hidden graph with the message. It works, but I would have all the categories in the graph at the beginning. My codes could only hide the graph (if the respondents number is less than 6) AND the categories in the graph (whatever the respondents number is and I need them). Hope this helps, thanks for your time.  All the best, Jojki
P1.PNGP2.PNGP3.PNG

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors