Home > Back-end >  PowerBI: Giving users the option to include or exclude a type of data
PowerBI: Giving users the option to include or exclude a type of data

Time:02-18

I'm creating my first PowerBI report, analysing staff absence data. The data contains a field of 'Absence Type', which categorises the type of absence the each record refers to.

I would like my users to be able to view my report both with and without the Absence Type of 'Pandemic'. I can hard-filter this on all pages by Excluding it but that gives the users no control.

I thought about using a slicer with a new custom column but I think that would be too confusing. If the column put a 'Yes' or 'No' as to whether the Absence Type was 'Pandemic', that would allow users to view the data without 'Pandemic' entries or just the 'Pandemic' entiries, but give no combined option. Even with a multiselect slicer they could easily deselect everything and see no results at all.

Ideally what I need is either an 'Include Pandemic?' slider where they can choose Yes or No (with Yes being everything and No being everything minus Pandemic records) or a button they can click to toggle the Pandemic records in or out of the visuals.

Apologies if this is has an obvious answer, I'm pioneering PowerBI for my organisation so don't really have anyone to ask here!

CodePudding user response:

In my opinion, the best solution would be tocreate a custom column that will have 2 values:

Pandemic - if the type is Pandemic Non Pandemic - if the type is different than pandemic

You would then use this new column Absence Type as a hierarchical slicer.

This would give the user the abilty to pick and choose between:

  • Select all (If the user deselects everything a select all will also be applied)
  • Non pandemic only
  • Pandemic only
  • Any one or more absence type

CodePudding user response:

There's a way to do this, but it's a bit painful. So you'll want to consider just putting a slicer on AbsenseType and letting the user figure it out.

The extensibility point you can use here is Buttons and Bookmarks.

You can create two buttons, each associated with a Bookmark. Each bookmark can activate set of filters, so one can exclude pandemic AbsenseType and the other can include it. Bookmarks can also toggle the visibility of visuals (see eg here). So when the "ExcludePandemic" bookmark is active, the appropriate filter is active, and the "Include Pandemic" button is visible. When the "IncludePandemic" bookmark is active, the "Exclude Pandemic" button is visible.

  • Related