Forum Discussion
Power BI - Filter Specific VIP + Show Non-VIP Together in Visuals
Hi everyone,
I’m working on a Power BI dashboard where I need to handle filtering logic for two types of employees: VIP and Non-VIP. Here's my current setup:
- Select VIP: A slicer filter that lets users select specific employees from the "VIP" group.
- All NAME: A slicer filter that shows all employee names (VIP and Non-VIP combined) but without any pre-applied filtering.
The Problem:
When users select specific VIP employees (e.g., Employee 10, Employee 11) from the "Select VIP" slicer, the visuals only show the selected employees (e.g., 2 VIPs). However, I want the visuals to display:
- The selected VIP employees.
- All Non-VIP employees.
For example:
- If there are 20 VIP employees, 80 Non-VIP employees, and the user selects 2 VIP employees, the visuals should display:
- The selected 2 VIP employees.
- All 80 Non-VIP employees.
- Total: 82 employees.
Attached Example:
I’ve included an example screenshot of the visuals before and after when filtering VIP employees (see attached image).
Attached Dataset:
Unfortunately, I couldn’t upload the dataset file directly, so here’s the dataset structure I’m using:
Employee_ID NAME VIP GROUP
| 1 | Employee 1 | VIP |
| 2 | Employee 2 | VIP |
| 3 | Employee 3 | VIP |
| ... | ... | ... |
| 20 | Employee 20 | VIP |
| 21 | Employee 21 | Non-VIP |
| 22 | Employee 22 | Non-VIP |
| ... | ... | ... |
| 100 | Employee 100 | Non-VIP |
Questions:
- How can I achieve this behavior where the visuals display the selected VIP employees and all Non-VIP employees together?
- Are there better ways to handle this scenario using DAX or alternative relationships?
Sorry for inconvenience and Thank you in advance for your help!
4 Replies
- tharunkumarRTKSuper User
Create a disconnected table either in DAX or power query. Here is the DAX expression for creating a table
Disconnected Employee List = VALUES(Table[Employee Name])Add the column from this table to your Employee Name Slicer.
Create another measure
EmployeeFilter = Var __SelectedEmployees = Values(DIsconnectedEmployeeList[Employee Name]) Var __Result = if(SelectedVale[Table[VIP Group]) = "VIP", if(SelectedValue(Table[EmployeeName]) in __SelectedEmployees, 1, 0),1) Return __ResultAdd the above measure as visual level filter and filter condition should be 'Is 1'
Do not forget to make necessary changes to the above expressions as per the table and column names in your model.
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
Did I answer your question? Mark my post as a solution! If I helped you, click on the Thumbs Up to give Kudos.
Proud to be a Super User!
- Anonymous_nFrequent Visitor
Thank you for the suggestion! It’s a great approach, but I was hoping to have two separate slicers: one specifically for selecting specific VIPs. Still, I really appreciate your help—thank you so much!
- danextianSuper User
Hi Anonymous_n
You wil neeed two disconnected tables - one containing just the VIPs and the other containing all groups. You can create them using DAX or M. Sample DAX calc tables
ALLEmployees = SUMMARIZE ( VIPData, VIPData[Employee_ID], VIPData[NAME], VIPData[VIP GROUP] ) VIPEmployees = SUMMARIZE ( FILTER ( VIPData, VIPData[VIP GROUP] = "VIP" ), VIPData[Employee_ID], VIPData[NAME] )And then a measure to return based on slicer selections
VIP Filter = VAR __LOOKUPTABLE = DISTINCT ( UNION ( VALUES ( VIPEmployees[Employee_ID] ), SUMMARIZE ( FILTER ( ALLEmployees, ALLEmployees[VIP GROUP] = "Non-VIP" ), ALLEmployees[Employee_ID] ) ) ) RETURN CALCULATE ( COUNTROWS ( VIPData ), KEEPFILTERS ( TREATAS ( __LOOKUPTABLE, VIPData[Employee_ID] ) ) )Please see the attached pbix for the details.
- Anonymous_nFrequent Visitor
Thank you so much! This is almost exactly what I need. There’s just one thing missing—if no VIP selection is made, I want VIPs to be completely excluded from the visuals. Currently, if nothing is selected, it shows all VIPs.
So, if I want to add another slicer that have 2 options: allows user to Include or Exclude VIPs:
- When Include VIP is selected, the slicer should show VIP names for selection.
- When Exclude VIP is selected, VIPs should not appear at all (no names to select).
Is this possible? Thank you again for your guidance—you’re amazing! 😊