Show or Hide a Power BI Visual Based on Selection - Excelerator BI

Show or Hide a Power BI Visual Based on Selection

Updated: 17 Jan 2020

I have written a few articles in the past that toy with the ideas of changing visibility and text colour based on selection.  I started to wonder if it was possible to make a visual appear (or not) based on a selection from the user.  There is no out of the box way to do that today. It is possible to use bookmarks to show and hide an object, but the user must click a specific button to do this. I want the user to be able to interact with a report and see (or not see) a chart based on some valid selection across the report.  Microsoft is already working on building expression based formatting across the breadth of Power BI however as of now the only item you can change is the header in a chart and more recently the background in a card.

Solution Overview

My solution to solve this problem involves.

  • Create a card to work as a mask for the visual.
  • Create a measure to display a user message on the card based on the user selection.
  • Create a measure to render the visual blank when nothing is selected
  • Write a measure that returns either the background colour or “transparent” based on the user selection, and set that to conditionally format the background colour of the card.

Requirement

I have a sample report below.  I want the matrix on the left to appear if the user selects an item in the category slicer on the right.  If there is nothing selected in the slicer, I don’t want to see the matrix at all, but instead see some instructions on what to do.

Hidden Visual Live Connection

Transparent Colours

The key to this solution is the expression based formatting of colours using DAX.  As I described in my article about conditional based text colours linked above, you can set the result of a measure as being any HEX colour you want using conditional colour formatting.  But as it turns out, you can change the transparency of a HEX colour like #FFFFFF by adding an optional additional 2 characters to the end (00 being 100% transparent).  So while #FFFFFF is white, #FFFFFF00 is 100% transparent (white).

The next trick was to have a box that I could colour white or transparent – enter the Card.

Create the User Instructions

The first thing I had to do was to create a measure that displayed a message to the user on the card.  I wanted to show the matrix when the user had selected an item in the Product[Category] slicer and display the message otherwise. This was easy as follows.

Message = 
   IF(
      ISFILTERED(Products[Category]),
      "",
      "You must first select a Product Category from the slicer to see the results"
   )

Write the Check Filtered Measure

The next thing I needed to do was write a measure that would make the matrix appear blank when no selection in the slicer had been made.

Check Filtered = 
   IF(
      ISFILTERED(Products[Category]),
      1,
      0
   )

Filter the Matrix to Render Blank

Select the matrix, and place the [Check Filtered] measure onto the “Filters on this visual”, and set the “Show items when the value: is 1”.  This renders the matrix with just 2 rows visible.  This means there is no need to cover the entire matrix with the card layer, we can just cover over the top two rows, to achieve the same visual effect. This is important as it means that the visual will render larger than the card when displaying information, which will enable click interactivity with the displayed cells for further cross-filtering the report.

Check Filtered

Blank Matrix

Create a Card to Work as a Mask

Next, I placed a card visual with the measures [Message] placed in the  “Values” section.  I made the card just big enough to cover the blank visual (top 2 rows). I turned off the card category label. Now the trick is to use conditional formatting for the card background colour using rule based expressions.

Power BI Online Training

Write the Transparent Measure

This was also pretty easy.  I wanted to show the matrix when the user had selected an item in the Product[Category] slicer and hide the matrix otherwise.  The measure I wrote therefore was this.

Make Transparent = 
      IF(
         ISFILTERED(Products[Category]),
         "#FFFFFF00",
         "White"
      )

In other words, if there is a value selected in the slicer, make the “colour” transparent, otherwise make it white (the colour of the report background) so that it hides the matrix.

Format the Card

Then I applied the measure to format the card background colour.  To do this, click on the Card, then select format\Background and switch it on. Then click on the ellipses on the right-side of Color as shown below.

Cond Formatting Card Background

Click on Conditional formatting, Select Format by as “field value” and then select the measure.

Cond Formatting Card Background 2

Importantly, the order of the visuals (front to back) needs to be:

  1. The card
  2. The visual to show/hide.

The Final Result

And here is the final result.

Hidden Visual Live Connection

You can download my sample workbook here.

137 thoughts on “Show or Hide a Power BI Visual Based on Selection”

  1. how to hide/unhide visuals based on selection (i need to put all visual names in slicer ,then user can select and see visuals which ever he wants , unchecked visual names will be hide)

  2. how to hide/unhide visuals based on selection (i need to out all visual names in slicer ,then user can select and see visuals which ever he wants , unchecked visual names will be hide)

  3. Hi matt, It really worked. Thanks to your article. However I need to use filters instead of slicers to filter things out as slicers makes report so much slow when using with comparitively huge data. Do you have any idea which works the same but with filters?
    Thanks in advance.

    1. Absolutely!
      Set your visuals up the same way, but instead of adding the slicer, simply place the trigger field onto your filters pane.
      It has the same effect.

    1. You can’t use this technique because of the “invisible” box will cover the slicer and hence you can’t click the slicer even when the box is invisible. But it occurs to me you could use DAX to control what options are in the slicer for the user to select. Maybe even an option saying “do X before selecting from this slicer”. If I have time, I may try it out and write a blog.

  4. Hello,
    exactly what I wanted to do (show a line graph only if a line selected in a matrix)
    and done in 10 minutes thanks to you

  5. Thank you for sharing this.
    I have tried this in my report and I downloaded your sample work book as well but noticed that your sample work book has same issue what I am facing. But the final result video above is working fine.
    so when I select the value in the slicer, the message is gone and matrix is displayed but the header (which were hidden behind the card when value was not selected) part is still hidden. Meaning the card is not being transparent to show hidden part when value is selected. Can you help me here what possibly I have done wrong? I followed all the steps above, do you think I had to add any more steps or lines of code to achieve this?

  6. Hi Matt! Thanks for the article. It is very helpful.
    When I try to apply the filter “Filters on this visual” is not working, as the matrix is not recognizing when the Check Filtered vales is 1 or 0. As consequence, is always showing data (Check Filtered always == 1).

    Thanks,
    Claudia

    1. I am not sure if you have found the solution, but I had similar situation until I covered up the intended visual with the card having the option of transparent background. In my experience, Check Filtered Measure has no influence and is not needed. Hope this will help.

      1. The Check Filtered Measure is only necessary if you want to have the visual appear blank prior to your selection.
        As you say, this isn’t necessary for the invisible card to work. It is only necessary if you desire to have a visual that can be clicked after the initial selection has been made.

  7. Brent van de Wijdeven

    Hi Matt, thanks for the great article!

    Unfortunately I get stuck at formatting the card. When trying to select the measure as field value –>
    “Click on Conditional formatting, Select Format by as “field value” and then select the measure.” I can’t select any measure there…
    Do you have any idea what might cause this?

    Kind Regards,

          1. Indeed, you need to be careful about the type of the measure, it should be a text. The default type is number and does could be the issue

  8. This show visual option does not work for card and donut chart. when I created a measure to find out if the slicer is selected like isfiltered and when we put this in visual level filter, it became unresponsive. do we have any alternative option for this or I am missing something.

    1. It shouldn’t matter which visual type you are using.
      I have successfully used this technique on donut charts without issue.

  9. Hi Matt,
    Can this possible if my visual is Hierarchy slicer . if possible can you mention required changes .

    Waiting for your reply,
    Thanks,
    Dharanidhar

  10. Hi Matt, is it possible to made same hiding technique to the below scenario
    As per my requirement, We have 10 visuals in one page( order by : 1 slicer, 5 tree maps, 2 tables , 1 bar chart and 1 line chart) all visuals needs to be appear only based on ealer filter.i tried but its not working as i expected bcz when i press 3rd visual and ot is filtering 4 visual but 3 visual became blank.

    Can you pls help me on that.
    Regards,
    K

    1. Well, conceptually I see no reason why it wouldn’t work for any number of visuals. Of course if you have many visuals dependent on the next visual status, then it starts to get more complex. This then becomes a DAX issue, and as such it can be tricky. My advice is to set up your DAX formulas in a table and test that they do what you want. If you get the DAX right, the rest should be straight forward.

  11. Thank you so much for the article! So simple, clear and works just great! I’ve been looking for the solution for quite a while and so glad I have finally found it!

  12. Another great article, however I want to be able to hide the entire (table) not Matrix based on the slicer. Meaning the area/table should be blank until the selection is made and then the whole table should show just the selection and it’s other details. Is this possible?

    1. Jason Cockington

      Hi Pablo,
      You will need to set your Table up like the Matrix described in the article, with the CheckFiltered measure attached as a filter on this visual, and the Message measure to the card. The card then simply needs to be placed over the header row of the table.
      This will make the entire table appear to be hidden until you select an apropriate visual elsewhere on the report. The only thing you wont be able to select as soon as the table becomes visible is the column headers. If you click elsewhere in the table though, this will bring the table to the front, and then you can click the column headers to sort.

  13. I cannot perform the interactions after this as the card acts as a barrier to the page, How can i make show the error message when no value is selected and the make the card disappear once a value is selected

      1. Hi Matt, Thanks for sharing wonderful trick..But there is a problem when we using more then 3 visuals..
        Can you pls help me on below senero:
        As per my requirement, We have 10 visuals in one page( order by : 1 slicer, 5 tree maps, 2 tables , 1 bar chart and 1 line chart) all visuals needs to be appear only based on ealer filter.i tried but its not working as i expected bcz when i press 3rd visual its bcame blank.

        Can you pls help me on that.
        Regards,
        K

  14. It was all going well until I got to the last step. There is no “…” option in my Background formatting for the card. No idea how to make the “. . . ” appear but conditional formatting seems to not be an option for my version of Power BI Desktop.

    1. Matt Allington

      Ok, so the obvious question is, “what version are you using”? Note, MS made changes in April 2020. The … is now gone and you just need to click on the Fx button

  15. That’s very good explanation , can we add an image to the existing transparent card . the user has to see picture with message in the card and when he selects the filter it has to show the result

    Thanks,
    Dharani

      1. Hi Matt,
        Can this possible if my visual is Hierarchy slicer . if possible can you mention required changes .

        Waiting for your reply,
        Thanks,
        Dharanidhar

  16. Lambert Marie-Julie

    Hello Matt,

    Thanks a lot, it really helps!

    Basically I’m doing similar things as you : when I select a country the message disappears and graphs are visible. But I have an issue to select or show labels of the graphs that were hidden. It seems that the transparent card does not let me interract with the graphs below it.

    Thanks a lot for your answer,

    Marie-Julie

    Here is the link to the dashboard I created using thes tips: https://app.powerbi.com/view?r=eyJrIjoiNzg2YWJlNTAtMDI0MC00OTVlLWE5YmEtMmJjMTY5YjIxNTU3IiwidCI6ImZmMTA1ZDRmLTAzOWYtNDQ0Zi1iZDZmLTBlZDFlMzVkYWVmNCIsImMiOjh9

    1. correct. This solution is simply show/hide what is beneath. Microsoft is working on making every part of Power BI controllable using expression based formatting. Currently there are lots of areas that can do this (including a chart heading) but often it has not been discoverable. This is now fixed. Where ever you can see the Fx button next to an item in the format pane, there you can use expression based formatting. Keep an eye out for the buttons.

  17. Very Clever – its too bad PowerBI doesnt simply have a conditional show option as an attribute of all visuals, instead of needing a kludge (clever as it is) like Qlik has had for over 10 years. Ug.

    1. You can’t compare the feature list of Qlikview (launched in 1994) with Power BI (launched in 2015) and say “Qlik has had this for 10 years”. Microsoft has already announced it is extending expression based formatting everywhere, and it will come.

  18. Hi Matt,

    With regards to “Show or Hide a Power BI Visual Based on Selection”, does it have to be a slicer and another visual or lets say can it be between two visuals (e.g. two tables)?

    Thank you

    1. Jason Cockington

      Hi Violet,

      The short answer is: No, it doesn’t need to be a slicer.

      Longer answer is, it depends what you’re trying to do.

      Let’s say I have two visuals I want to hide/appear based on selections.
      The first is a column/line chart showing Total Sales by Country and Region.
      The second is a table showing Total Sales by Country & Region.

      I want both visuals to appear based on a selection of either Customer[Occupation] or Territory[Group].

      I can set up slicers to select either Occupation or Group, but I could also use for example, a Pie Chart of Total Sales by Territory[Group], or a Matrix with Customers[Occupation] on rows and Total Customers on values to the same effect.
      The critical element here is that I need to change my default visual interaction behaviour in the report from Cross Highlighting to Cross Filtering to engage the hide/unhide interactions correctly. If this isn’t set correctly, then the selection visuals won’t impact the hidden line chart correctly. The hidden table will be fine, because cross filtering vs highlight filtering makes no difference to a table, but it does impact how columns are displayed, and thus we need the selection visuals to act as slicers and apply a filter across the page.

  19. Thanks for this! i managed to add it to my report and it works great except for the gauge graphs. Can you help me with this?

  20. Hello Matt,

    Thanks for your article, it’s really useful and well thought !

    I have a challenge about it and i’ve been searching a solution for days without success.
    So basically I’m trying to do the same as your example with a few differences :

    – I have 2 slicers that must influence the message and the blank visual : Country & Customer
    – The visual is a “line and clustered column chart” with 2 categories (Country & City) in the shared axis (they’re linked by a drilldown, Country > City )

    So i created these 2 measures :
    1) Message = IF(
    OR(ISFILTERED(Country); ISFILTERED(Customer)); “”;
    “Message”)
    2) Check Filtered =
    IF(
    OR(ISFILTERED(Country);
    ISFILTERED(Customer)); 1 ; 0)

    Until there, it worked perfectly, but I started experiencing issues with the visual, it won’t become transparent when there are two categories (Country & City) in the shared axis field, or only Country in the field for instance.

    Any idea about the cause of this isssue and how to solve it ?

    Is it because the category “Country” can not be the filtering/blank condition while being an axis of the chart ?

    Thanks in advance,

    1. Jason Cockington

      Hi Max,
      The problem with your working is that your chart axis is using the same column of data as your CheckFiltered measure. As a result, your CheckFiltered measure is effectively always selected, and thus cannot hide the chart as intended.
      Are you able to work with an additional column of data within your Territory table, say Territory[Region]?
      For this to work, Territory[Region] would need to have the necessary data to allow a differentiation to the appropriate countries when the chart materialises from a Customer[Name] selection on the slicer.
      I have included an example solution in this workbook.

  21. Hello, your solution looks great! and it’s exactly what I need, however I can’t use “checkfiltered” measure as a filter on my card (or any) visualization, would you have any idea why?

    Thank you!

    1. Jason Cockington

      Hi Rita,
      You can’t use the “CheckFiltered” measure on a card because a card only displays a single value, and thus can’t be filtered.
      The “Message” measure goes onto the card, and the card background is formatted with the “Make Transparent” measure.
      The “CheckFiltered” measure goes onto the chart/matrix you wish to hide.
      Hope this helps.

  22. It’s all clever stuff…….but the key thing I think when reading this (as someone who uses Power BI, Tableau and Business Objects) is why on earth is there not a native hide function in Power BI?! Personally, I find PBI to be a distant 3rd to the other tools I mentioned.

    1. The answer is simple: Power BI is 4 years old, Tableau is 16 years old and Business Objects is 26 years old. I am sure Power BI will have a native hide function in the future as Microsoft continues to develop the product over the years ahead.

  23. Hi Matt,
    This solution worked great for me. I have a quick question, though. I am using this solution to mask a bar chart until a selection is made. However, I think because it covers the bar chart area, I am losing the “mouse over” tool-tip information on the bars in the chart. Do you know of a way to stop this from happening?

    Thanks!

    1. Jason Cockington

      Hi Shannon,
      The challenge you have here, is that you are trying to hide the entire chart until a selection is made.
      The solution to give you this effect, but still allow you to maintain interactivity with your bars, is to only hide the elements of the blank Bar Chart, prior to selection.

      1. Write an additional Message measure, that renders a blank card

      Message Blank = 
         IF(
            ISFILTERED(Products[Category]),
            "",
            ""
         )

      2. Apply formatting to Message Blank card:
      – remove category label
      – conditionally format background colour with Make Transparent measure, as you did with your original Message card.
      3. Resize your original Message card to just cover the Bar Chart Title, and place a Message Blank card over each of the axis of your chart, so that the space where the bars render remains uncovered.

      Now, when nothing is selected in your slicer, you will see your message. Then when you select a value in your slicer, the Message card and the Message Blank cards will become transparent, so your Bar Chart will appear to have materialised based on the selection, and your bars will remain fully interactive, allowing you to mouse over for tool-tips, or click a bar for cross-filtering.

  24. Hi, I created all the measures as per the instructions here. I have 4 filters which I need to have selected for a visual to appear or become active. the check Filtered and the Message work fine, however I am not able to select the Make Transparent measure as a field in the background color conditional formatting options. It seems to be grayed out. any idea why?

  25. Hi Matt, This is great! Can you help me with my situation where in I have a bar chart for annual revenue with 7 bars by the top 7 clients and I only wish to highlight and display the name of the selected client from a filter, while not revealing the names of the other 6 clients, but showing their revenue stats?

    1. For customer presentations? I can’t think of any way to selectively show or hide one of the labels. I think you may have to turn off the labels for customer and add a manual text box. I guess yo could add 7 text boxes manually, and conditionally for at each of them to have the text transparent or black. Or maybe create 7 blank cards and control which of them are shown or hidden. You would have to manually place them over the customer names however, and that would be an issue if the chart redraws.

  26. Hi Matt, Thank you for the suggestion. I tried it and i was able to successfully hide a visual. But can you help me acheive the same functionality if i click on a scatter plot instead of filtering? I have a functionality where in i click on a data point in a scatter plot, i need to unhide the visual

  27. Hello Matt,

    Thank you for your interesting solution.

    I have tried to use it, but I faced with the following problem.
    The matrix(table) has no react on the filter “Check filtered”, being included in “Filters on this visual”.
    Moreover, if I change the values “0” and “1” in “Check filtered”, the matrix will be hidden forever without any reaction to check boxes.
    The picture of the described case is available by the link on google.drive: https://drive.google.com/open?id=1Y3kDvtsWiI9uDiBOUbutEEdXkBi9PUsX

    Thanks in advance for any help!

    1. Jason Cockington

      Hi Sergi,

      Looking at your image, it appears you have placed the Check Filtered measure onto your card.
      You need to place the measures as follows:
      1. Message – onto card fields
      2. Make transparent – onto card background, conditional formatting, field value
      3. Check filtered – onto matrix, filters on this visual

      If you’re still having trouble, check out this how-to video if you’re still having trouble.

      1. Hello Jason,
        I am having the same problem as Sergei. What he showed in the image is that if the filters is selected or not, it is showing data (not hiding the results of the matrix).
        If Check filtered == 0 the matrix is showing data. If Check filter is = 1, the matrix is showing data.
        Would you know why it is not getting applied the filter in visualization filters?
        Thanks in advance,

  28. Hello, I’m having an issue with the Check Filtered measure – when I add this into “Filters on this visual” I can’t interact with it at all? it doesn’t seem to let me add any visual filters onto it, the drop down menus don’t populate and I can’t click in the boxes to enter text.

    1. Jason Cockington

      Hi Jace,
      Just double checking that you are placing the Check Filtered measure onto the Matrix and not the card.
      You can’t interact with measured filters on cards. If you click on the Message measure that is on the “Filters on this visual” of the card, you are not able to adjust its settings at all.
      In order to render the Matrix blank, it is the matrix that needs to be filtered by the Check Filtered measure.

      Check out this how-to video if you’re still having trouble.

      1. Thanks Jason,

        I had originally shown this as a card however I realised this was a limitation and changed it to a matrix, however I have just one measure in this under values and nothing in rows/columns – will this be the reason I can’t add a filter?

        1. Jason Cockington

          Hi Jace,

          Yes, that’s right. You need to have at least two values in the visual you are trying to hide (filter) with the Check Filtered. It doesn’t have to be a matrix, it could be a pie chart, column chart, or anything that takes at least two field values to display correctly.
          If you place something onto the rows, then the Check Filtered measure will work.

          If your target visual only requires the one value, and you just want to show or hide that, then skip the Check Filtered steps (skip: Write Check Filtered Measure & Filter Matrix to Render Blank), and just place the Message card over the entirety of the visual you are trying to hide.

  29. Jason Cockington

    Combining Matt’s solution with Maxim’s [Check Filtered] measure, allows for a more interactive experience for some visuals.
    With Matt’s matrix example, rather than covering the entire matrix with the message card, one only needs to cover the top two rows (those that would display when the matrix is blank thanks to [Check Filtered]).
    Then when the slicer is active and the card becomes transparent, it is possible to interact with the rest of the matrix and further cross-filter the report.

  30. Good solution, but the problem with it is that the card retains foreground focus and the control underneath is basically inoperable: no hover, selection, cross-filtering, …
    Anybody have a fix for that? AFAIK, the Z-order for visuals doesn’t change at run-time.
    The best I can come up with is covering options with bookmarks (no drop-downs obviously) and bookmarking the selection. Ugh.

      1. No kidding…this has been a thing in Qlikview (the old tool of choice at my company) for over a decade. I hope they implement it soon.

  31. Hi Matt,
    I have one challenge in our BI reporting.
    I have sales 1, sales 2, customer1, customer 2, item1, item 2 , date, sales lines 1, sales line2, sales history table
    Sales 1 joined with Sales lines 1 and Item 1 table. Sales line1 joined with date and customer 1 table
    Sales 2 joined with Sales lines 2 and Item 2 table. Sales line2 joined with date and customer 2 table
    Sales History joined with all the customer, item and date table.

    Have to combine Sales 1 & Sales 2 and sales history and report on this.
    What i did is: appended sales 1 and sales 2
    appended customer 1 and customer 2
    appended item 1 and item 2
    appended Sales line 1 and sales line 2
    Joined with the fact tables with respective dims above
    1st challenge: while joining the Sales history with Customer (Appended) i couldn’t make it active (seems data granularity issue)
    2nd challenge: sales history having the data until may 2019 remaining facts have data from June 2019.
    I used fiscal month as slicer. Since i couldn’t join the customer table when i use customer name and total sales from all 3 facts) the measure is not giving proper result.
    I would like to use different Customer copies one for Sales history and other for Sales table. and i want to choose customer name from either customer table joined to sales or customer table joined to sales history. Is that possible. also let me know is there any other alternative to face this issue.

  32. Hi Matt,

    I have a scenario when I have three constant lines (they do not come from Analytics) but rather a data columns (temperatures like extreme heat, comfortable low, comfortable high). On my slicer I have weather attributes (temperature, humidity, wind and pressure). I only want to display the three lines if the Temperature is selected. They do not belong to other attributes. How do I make them transparent? I can do any conditional formatting under the Data colors.

    Thanks,
    Stan

    1. The IF construct allows you to control 2 outputs; a null string or a custom message. SELECTEDVALUE will allow you to control one output only, with the other output being the value in case there is a single selection. I wanted to control both items. Yes you could use SWITCH(TRUE()), but that seems over kill unless you need more than 2 outputs

  33. Hi Matt.
    Solution work great, but there is one issue: if i want to hide matrix table, and show only if filterred, matrix table is not clickable (stepped layuot) or cant export to excel. The problem is that transparent visual is over matrix table, and that’s why user cant click on matrix table.
    Is it possible to solve it?
    Thx

    1. Yes, that is the issue. I don’t know of anyway to solve this particular problem. In the future I would expect that expression based formatting will solve the problem but as of today I don’t know of a solution

      You could take a different approach however. it is already possible to use expression based formatting to set the background colour of objects. I am not 100% sure but I think you can do this with a matrix and table (you definitely can with cards), you would have to check. So one idea would be to set the background colour of the matrix to be read if it is not correctly configured. Another approach would be to set the title of the chart to give a message instructing the user to select a value first

  34. Murray Foxcroft

    Cool and clever approach, but the transparent card gets in the way of interacting with the underlying visual. 🙁

  35. Hi Matt,

    Here is my solution:
    Check Filtered = IF(ISFILTERED(Products[Category]),1,0).

    Place the measure to Filters on this visual tab and in Show items when the value: is 1

    Hope it helps anyone.

  36. Hello Matt,

    I experimented with your hack to show or hide some menu buttons based on certain values in a table, to restrict access to certain pages in my report
    But one problem: if the button is visible and the transparancy is on of the card or shape (rectangle) that’s used to hide the menu-button, it’s not possible to use the click to another page , because you’re still clicking on the card that’s used to hide the button, and not the button itself.
    It’s the same if you hide for example a chart or table, it’s not possible to click in it to filter another visual

    Have you experienced the same problem and have maybe (hopefully) a solution?

    1. Yes, you are right – I found this too. In my example you can’t select the visual hidden then shown for the same reason. I realise my concept is a hack and it has some limitations. Microsoft has announced that it will continue to build out expression based formatting across the product. So I hope and expect that at some stage we will be able to use a measure to make any visual visible or not

    2. Hi, in my case I wanted to hide a table. The scroll wheel didnt work when it was fully placed over the table but when I leave a bit of space on the right side it does work when the white space is gone. Might help with your problem aswell if you tried to scroll on your visual.

  37. Hi Matt,

    Great article, I am uunable to locate ellipses on the right-side of Color on card visual. I am using May 2019 release of PowerBI

  38. Simon Schofield

    Hi there, is there a way to amend the ‘Make Transparent’ measure so that when a certain value is selected from the slicer the transparent treemap is activated, rather than no value being selected from the slicer. Cheers

  39. Hello! A great tip, thanks for it!! Do you think the same would be possible if one bar in a bar chart is selected. With that I mean if a user would click on a bar, more details would appear (the treemap would become transparent) depending on the selection of the bar. (each bar has a unique ID).
    Thanks million times!

    1. You would have to test it. I am expecting more expression based formatting to come to Power BI in the future, so hopefully at some stage this will be a feature rather than a hack.

  40. My guess is that you have cross filtering set to “highlight”. If that is the issue, change “edit interactions” to “filter”. It is on one of the menus visible when you select the matrix.

  41. Hi, Instead of Slicer selection, I tired with Matrix row selection. With the Matrix row selection, I am not able to achieve the same thing. Could you please let me know how to use with Matrix row selection (SelectedValue) instead of a Slicer? Thank you in Advance.

  42. Pete Watridge

    Hi Matt — really enjoy your articles — have your website on my regular “to read” list. Your insight of using Treemap as a controllable color shape was brilliant and an eye opener for me. I had a project where I needed the background color of a matrix to be controlled by filters. So I adapted your approach: I made the background of the grid 100% transparent — and then put the treemap “background” behind it that responded to the filters via DAX formula. It worked perfectly. Never would have thought of using treemap as a controllable background without this article. Many thanks!

  43. Dang: This doesn’t work for me when saved to the PBI service and rendered in IE (version 11.0.120).
    Works fine in chrome. But our users have IE as the default.

    Anyone manage to get it working in IE?

  44. Hey Matt…I just spent ages trying to replicate your trick to no avail, until I finally realised that I was trying to trigger it from a Table (not a Slicer) and the default behaviour was to crossfilter the Treemap rather than filter it. Meaning it didn’t work. Perhaps you could include another step in your instructions above showing how to change the “Edit Interactions” behaviour of the TreeMap from Crossfilter to Filter, so this cool trick can be used for other types of trigger visuals.

    But I love it, man.

    1. Another way to accomplish this is to use visual level filters combined with dynamic titles. Create a measure that is 1 if filtered, 0 if not. Drag that measure to filter pane and set to only show when measure=1.

      You can also use that measure within the dynamic title to have it display a message. I use this for data tables when I don’t want all of the information showing until a user has filtered it.

      1. @Stu I use that trick too. But this method of obscuring both the data and the headers means you can do additional stuff like overlay different types of visuals on top of each other, and trigger a bookmark-like experience from a Slicer, which is very cool (and should be allowed natively).

  45. Is it possible to do the trick on two slicers with an OR function or similar? So the message would disappear if one selected the first slicer or if they just selected the second slicer?

  46. Hi Matt – Great Article, when i was experimenting with the file i realized that instead of writing the hex code for transparent as #FFFFFF00, one could just write “transparent” and it works.

  47. Could this work to highlight a sub-group in a scattergram? i.e. make the unselected sub-groups more transparent than the selected one.

    1. The principle of a measure that formats a data point is the same, I think. So as long as you can write the DAX, you will be able to do what you suggest. But what you will need to do is have your slicer either with an inactive relationship, or no relationship at all, otherwise the slicer will filter the visual. I assume that changing the cross filter behaviour between slicer and visual will not work in this case, but I can’t be sure.

      1. Great thanks, I solved it as you say by overlaying two scattergrams with the same set axes and one which has an inactive relationship to the slicer

  48. This is awesome Matt! I’ve been trying to find a way to do this as well, the treemap approach is pretty brilliant.

    One thing to note regarding optimization: the matrix is still calculating even though you can’t see it. That means a potentially large DAX query is still running in the background…possibly slowing down other visuals.

    You may want to adjust your matrix measure to the following:
    [Matrix Measure with Check] :=
    IF(
    ISFILTERED( Products[Category] )
    ,[Matrix Measure]
    ,BLANK()
    )

    This will return BLANK() if there’s no selection, saving the other measure from being evaluated.

    1. Yes, this would be another approach. I was really trying to find a problem to match my solution – the idea of using transparency to hide or show an object on the canvas. I am sure my solution has other applications too. For example, you could create an instructions section on the page, and overlay multiple text boxes with multiple instructions, all set to transparent text and transparent background. When certain conditions are met, you could display the appropriate instruction by changing the transparency.

  49. Nice workaround. Coming from the Qlikview world and having used that for the past 8 years, it’s amazing to me that simple SHOW/HIDE conditions are not available yet in PBI. This conditional formatting they are starting to roll out makes me feel like they are starting to get it and PBI is getting more and more Qlik like with every release.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top