Custom Power BI filter pane with hide/show feature

Having as much possible Power BI estate when it comes to putting the visuals for data exploration, is everyone’s dream. But the slicers for “slicing and dicing” the data is also very important. Having all the slicers hidden has always been mine go-to design.

Several similar ideas have been shown, Guy in a cube (Adam and Patric) have both done similar ideas over past years, many questions have also been answered on Power BI community website. And mine requirements were similar:

  1. have the ability to hide the filter pane
  2. have the selected slicer items listed

 

01

In general, what always bothered me, was that left or upper side of Power BI Page would always hold the slicers and selections, which might make page slightly crammed and hence rather unclear.

1. Getting data

 

Diamonds data-set is available at Github. Another way to get this data-set is with R script:

library(ggplot2)
attach(diamonds)
write.csv(diamonds, file="diamonds.csv",sep=",")

Once you have the data, let’s start digging in Power BI. In general, we will create two main things: 1) hidden filter pane and 2) filter selection cards.

2. Creating custom filter pane

 

First, we will need to get the data into Power BI. Once you add your desired visuals on the page, we can start with creating the filter pane.

1) Add a shape on Page, in the case of this example, the rectangle

2) Add the slicers for the data to be “sliced and diced”. In case of this example, we are adding two:  Cut and Clarity. So it should look like this:

02Now we need to give it a little bit of logic in order for the pane to work. Under view, select the pane “Selection” to be viewed besides the Visualization and Fields pane.

03

3) Group the elements: Shape, Slicer, Slicer:

04

And rename it to Filter Pane.

4) Under Insert, go to Buttons and add Back (Back button) to the Filter Pane, and it will be automatically grouped.

05

5) Add an Image or Button or any type of placeholder for your user to be able to show (invoke) the filter pane (menu icon is also available on Github). So adding the image on Power BI Page and placing it where the user will be able to see it and use it easily.

06

(Note: At this time, the shape with both slicers and back button is hidden).

6) We will create Bookmarks for both: a) shown filter pane and b) hidden filter pane. Under menu View, select Bookmarks.

07

7) Create new bookmark with Filter pane hidden. Rename it as “Filter Pane Hidden” and click the ellipsis and uncheck Data (as shown on  print-screen). This will not apply any selected slicer values when hiding or showing filter pane (clicking the bookmarks).

08

8) Create another new bookmark with Filter pane shown. Repeat all the steps as with the first bookmark.

09

By clicking on the bookmarks, you should be able to see the filter pane appear or disappear.

9) With both bookmarks created, now we need to assign both bookmarks to menu button and to back button. Make sure you have the filter pane hidden. Click on menu image (1).

010

Under the Format Image, select Action (2), Change (3) Type to Bookmark and select (4) Bookmark “Filter Pane Shown”. Optional, you can add (5) Tooltip as a caption to the menu image.

10) Repeat for the Back Button. Make sure you have selected the “Filter Pane Shown” bookmark. Click the (1)  Back button and under the Visualization, under (2) Action, select (3) Type Bookmark and select (4) bookmark “Filter Pane Hidden” and optional add the caption for the back button under (5) Tooltip.

011

Before going into testing the bookmarks, make sure you have the correct order of objects in Layer order under the Selection Pane:

012

In this Layer ordering, when opening Filter Pane it will always be on top, regardless of objects underneath the Filter pane.

To test the Menu, Filter Pane and Bookmarks, make sure you hit CTRL + mouse Click. This way you will invoke the filter pane.

013

3. Show selected filters

Now that we have the filters hidden from the users, it would be also fair, to have the information about the selected filters in form of a card, available for the end users.

For both slicers (cut and clarity), I will add a card visual for each.

Create new measure and add DAX:

Diamonds Cut Selection = IF
(
  ISFILTERED(diamonds[cut]);
  SELECTEDVALUE(diamonds[cut]; "Multiple cuts selected");
  "Filter not selected"
)
And for Clarity, we will create two measures with DAX. First one will be same as the previous one:
Diamonds Clarity Selection = IF
(
  ISFILTERED(diamonds[Clarity]);
  SELECTEDVALUE(diamonds[clarity]; "Multiple colors selected");
  "Filter not selected"
)
And the selections measure will include the previous one:
Diamonds Color Selections = 
   VAR Conc = CONCATENATEX(VALUES(diamonds[clarity]);
               [Diamonds Clarity Selection];",")
RETURN(Conc)

This combination will concatenate the selected values, so that the end users will be able to see the list of all selected values.

014

At the end both results are seen as (and some additional design enhancements):

015

 

Code to this example is available at Github.

Happy DAXing!

 

 

 

Tagged with: , , , , , , ,
Posted in Uncategorized
2 comments on “Custom Power BI filter pane with hide/show feature
  1. […] Tomaz Kastrun walks us through creating a custom filter pane in Power BI: […]

    Like

  2. jenn says:

    thanks for this. really helped. however there is an issue when exporting pdf with current values when the filter pane is “hidden”. it prints the data with the default values and not the applied filters.

    Like

Leave a comment

Follow TomazTsql on WordPress.com
Programs I Use: SQL Search
Programs I Use: R Studio
Programs I Use: Plan Explorer
Rdeči Noski – Charity

Rdeči noski

100% of donations made here go to charity, no deductions, no fees. For CLOWNDOCTORS - encouraging more joy and happiness to children staying in hospitals (http://www.rednoses.eu/red-noses-organisations/slovenia/)

€2.00

Top SQL Server Bloggers 2018
TomazTsql

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

Discover WordPress

A daily selection of the best content published on WordPress, collected for you by humans who love to read.

Revolutions

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

tenbulls.co.uk

tenbulls.co.uk - attaining enlightenment with the Microsoft Data and Cloud Platforms with a sprinkling of Open Source and supporting technologies!

SQL DBA with A Beard

He's a SQL DBA and he has a beard

Reeves Smith's SQL & BI Blog

A blog about SQL Server and the Microsoft Business Intelligence stack with some random Non-Microsoft tools thrown in for good measure.

SQL Server

for Application Developers

Business Analytics 3.0

Data Driven Business Models

SQL Database Engine Blog

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

Search Msdn

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

R-bloggers

Tomaz doing BI and DEV with SQL Server and R, Python, Power BI, Azure and beyond

R-bloggers

R news and tutorials contributed by hundreds of R bloggers

Data Until I Die!

Data for Life :)

Paul Turley's SQL Server BI Blog

sharing my experiences with the Microsoft data platform, SQL Server BI, Data Modeling, SSAS Design, Power Pivot, Power BI, SSRS Advanced Design, Power BI, Dashboards & Visualization since 2009

Grant Fritchey

Intimidating Databases and Code

Madhivanan's SQL blog

A modern business theme

Alessandro Alpi's Blog

DevOps could be the disease you die with, but don’t die of.

Paul te Braak

Business Intelligence Blog

Sql Insane Asylum (A Blog by Pat Wright)

Information about SQL (PostgreSQL & SQL Server) from the Asylum.

Gareth's Blog

A blog about Life, SQL & Everything ...