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.
Hi everyone,
I have a visual that I want to display data only when the user selects a category from a slicer. If nothing is selected from the slicer, I just want a blank space. I found this post, which has a nifty little solution to this by overlaying a treemap that colours transparent when a slicer value is selected, but otherwise is opaque white to hide the visual beneath: https://insights.votivasoft.com/show-or-hide-a-power-bi-visual-based-on-selection/
I've tried to use this method, but my dax code doesn't recognise the hex code "#FFFFFF00" as transparent. It just reads it as white. I'm thinking that the conditional formatting only reads the first 6 characters of the hex code? I'm just not sure why this is. I've read around and it seems that other people's dax code using this method works and does indeed produce a transparent box. Does anybody have any idea why this isn't working for me or has an alternative solution?
Many thanks in advance for any help.
Solved! Go to Solution.
Hi @Anonymous ,
I tried the following measure for transparency at my end without SWITCH statement and it works for me:
Hi @Anonymous ,
I wrote a blog sometime back on similar functionality. Can you check once if you are following all these similar steps:
If still it doesn't work, then share your pbix file by removing any sensitive information from it.
Also I am wondering; if this was not working then why was the solution accepted. 🙂
Thanks,
Pragati
Hi @Pragati11
I have the same problem, But my Matrix Visual is made up of all measures I created. So i can not pull "Filter Selected" measure to my table visual's visual-level filter section. The filter does not give me the optipon to drop down and select "1" or "2". What should I do?
Hey @Pragati11 ,
Thanks for addressing the concern but can't share the screenshot. You can create simple measure>put it in table> and try to apply Filter Selected on Visual level filter on that Table Visual. It won't work, may I know why?
HI @Anonymous ,
If you can't share the screenshots ot the perocess you are following, I won't be able to understand your issue properly.
What measure are you moving to table visual?
You said matrix earlier and now you are saying table visual.
Apologies but can't help until I see a details on your scenario. 🙂
Also at my end, everything works perfectly fine.
I have just moved a Total Sales measure in my table visual and the table only displays data when I make a selection in the slicer.
I am able to apply visual level filter successfully.
If this still doesn't work at your end, you will have to share details. You can create similar scenario using some dummy data and share screenshots.
Hi @Pragati11 ,
Sorry for misunderstnding. Here is the sample data Snippet,
Slicer > Customer Name; which is a column in my Table
Count > Matrix Visual; which is a measure
If I create,
Filter Selected =
IF (
CALCULATE (
HASONEVALUE ( Client[Customer_Name] ),
ALLSELECTED ( Client )
)
= TRUE (),
1,
2
)
If I try to apply the "Filter Selected" measure on my Matrix Visual, but i can't apply on it.
I can not dropdown and Select "1". You could do it in your example, maybe because your columns are directly coming from your data, they may not be measures. Hope you have understood the problem. If not, let me know I will explain again but want to solve it anyow.
HI @Anonymous ,
I mentioned in my previous response that I am using a measure on my matrix and I am able to apply visual level filter.
Are you saying against Filter Selected measure, you are not able to chnage selection using dropdown as shown below:
You need to select is option from dropdown. --> Then write "1" in the next box --> Then APPLY
If this doesn't work, try following:
Filter Selected measure is based on your CUSTOMER NAME column.
I suggest moving CUSTOMER NAME and COUNT measure to your matrix visual.
Then try applying Filter Selected as a visual level filter to your matrix. This should work.
Hi @Pragati11 ,
Thank you very much for your inputs. Your given solution solved my problem. I appreciate your help.
HI @Anonymous ,
If the solution helped and solved your issue, don't forget to mark my response as a solution.
This may just help someone else in the future on the forum. 🙂
Hi @Anonymous ,
Can you share your measure please? I tried the similar scenario at my end and it works.
Do add some screenshots as you haven't shared anything on what you are seeing at your end.
Thanks,
Pragati
Hi @Pragati11,
Thanks for your response.
So here's my visualisation:
And this is the measure I'm using:
Here's the visualisation with my overlaid treemap (which I've made smaller so you can see how it's just opaque white). Based on the measure it should be transparent now, since a slicer value is selected, but it remains solid white.
I know it's a problem with the transparency, as if I change the measure to show blue when a slicer value is selected, the treemap does indeed turn blue when I use the slicer.
Any ideas what I'm doing wrong?
Thanks very much.
Hi @Anonymous ,
I tried the following measure for transparency at my end without SWITCH statement and it works for me:
Hi @Pragati11
Thanks for your reply and sorry for the delay in responding. It still doesn't work for me -- I had initially tried using the IF statement and it hadn't worked, so I tried using the switch function instead.
This is what I see:
I know the problem lies in the transparency because it works when I change the colour. So for example, if I set it to turn blue when the slicer is selected but otherwise remain white, it works:
Any ideas why it's not working for transparency?
Thanks in advance!
Hi @Anonymous ,
Your DAX is different to what I suggested. Can you use exact DAX and try:
Hi @Anonymous ,
I wrote a blog sometime back on similar functionality. Can you check once if you are following all these similar steps:
If still it doesn't work, then share your pbix file by removing any sensitive information from it.
Also I am wondering; if this was not working then why was the solution accepted. 🙂
Thanks,
Pragati
Thanks @Pragati11 ,
The solution in your blog post works perfectly and was exactly what I was after. I'd initially tried something similar, but hadn't managed to get it working! So thank you for that, it's super helpful.
Someone else had accepted your previous solution, not me! 🙂
Thanks again 🙂