6

Dynamically Highlight Data Points Based on Slicer Selection!

 9 months ago
source link: https://datamozart.medium.com/dynamically-highlight-data-points-based-on-slicer-selection-0905850d0d5c
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Dynamically Highlight Data Points Based on Slicer Selection!

Sometimes, common Power BI requests can make you scratch your head. Learn how to implement an effective workaround to dynamically highlight data points based on the user selection!

1*Ly7gsfybok0G1lZCawwSDA.png

Image by author

Just recently, I was working on the Power BI report for one of the clients, where one of the requirements was to highlight specific data points in the clustered bar chart visual, based on the slicer selection.

To illustrate the requirement, I’ll be using a Contoso sample database:

1*E4yy-Tp13VK0NO7s1FfDTw.png

Image by author

To quickly explain: when a user selects, for example, Contoso in the slicer, the Contoso bar should be highlighted by using a different color. As much as this sounds like a very basic and common business request, there is no straightforward solution in Power BI (or, at least, I’m not aware of it:))

However, the client’s wish is (almost) always our command — so, let’s see how this feature can be implemented with a little bit of data model tweaking and leveraging some DAX code.

Setting the stage

As you may see in the following illustration, a data model is fairly simple:

1*2MrOoNSCEMMCOpyzzZKlxQ.png

Image by author

We have only two tables: DimProduct as our dimension table, and FactOnlineSales as our fact table. The first “problem” we have with a data model like this, is that when a user selects something from the slicer, the filter will be propagated and our bar chart visual will only display corresponding values:

1*FAtuBCz0cHiXYlMVjfiFhw.png

Image by author

Therefore, the first thing we need to ensure is that when a user makes a selection, the bar chart visual is not affected. Remember, our goal is to keep all the brands displayed, while coloring…


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK