The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
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