Forum Discussion

Anonymous_n's avatar
Anonymous_n
Frequent Visitor
1 year ago

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:

  1. Select VIP: A slicer filter that lets users select specific employees from the "VIP" group.
  2. 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:

  1. The selected VIP employees.
  2. 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

1Employee 1VIP
2Employee 2VIP
3Employee 3VIP
.........
20Employee 20VIP
21Employee 21Non-VIP
22Employee 22Non-VIP
.........
100Employee 100Non-VIP

Questions:

  1. How can I achieve this behavior where the visuals display the selected VIP employees and all Non-VIP employees together?
  2. 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

  • Anonymous_n 

     

    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 __Result

    Add 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_n's avatar
      Anonymous_n
      Frequent 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!

  • 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_n's avatar
      Anonymous_n
      Frequent 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! 😊