Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Filter data based on two condition with included and not included

Hi,

 

I want to have two slicers based on the same column in PowerBI to filter my data.

 

The dataset is following:

fatih_kkk_2-1693226192532.png

 

The slicers are based on the column "Used_Function". With the first slicer I want to get all users which used the function. And the second slicer defines the Users which has not used the function. 

 

For example, if I want all users which has used the function "strategy" but not "Settings", then I want the names "Max", "Max", "Milian", "Milian".

 

How can I solve this task in PowerBI?

 

I want to have a dropdown were I can select products and a visual where I can see the users which havent bought this product in the selected time. 

 

 

 

1 ACCEPTED SOLUTION
Sergii24
Super User
Super User

Hi @Anonymous, you'll need couple of things to achieve the desired result:

  1. Disconnected table with unique values of "Used_Function"
  2. Measure that will combine filters applied on "Used_Fucntion" from both tables
  3. Add a newly created measure as a visual level filter to a table with UserID

First, the disconnected table:

 

FilteringQuestion_DisconnectedFunctions = DISTINCT( FilteringQuestion[Used_Function] )

 

Sergii24_0-1693229036828.png

 

Now, the measure:

 

Filter_Measure = 
VAR _DisconnectedFunction = VALUES( FilteringQuestion_DisconnectedFunctions[Used_Function] )            //get the list of fucntions to exclude
VAR _DisonnectedUsers =                                                                                 //get a table of 1 column of users who have values for currently selected disconnected function
    SELECTCOLUMNS(
        FILTER(
            ALL( FilteringQuestion[UserID], FilteringQuestion[Used_Function] ),
            FilteringQuestion[Used_Function] in _DisconnectedFunction
        ),
        "@Users", FilteringQuestion[UserID]
    )

RETURN 
    IF(
        SELECTEDVALUE( FilteringQuestion[UserID] ) in _DisonnectedUsers,
        1,
        0
    )

 

 

The final step is apply a visual level filter on both tables (Filter_Measure = 0 to the one on the left and Filter_Measure = 1 to the one on the right)

Sergii24_1-1693229313941.png

 

Let me know if it works as you expect 🙂

 

 

View solution in original post

2 REPLIES 2
Sergii24
Super User
Super User

Hi @Anonymous, you'll need couple of things to achieve the desired result:

  1. Disconnected table with unique values of "Used_Function"
  2. Measure that will combine filters applied on "Used_Fucntion" from both tables
  3. Add a newly created measure as a visual level filter to a table with UserID

First, the disconnected table:

 

FilteringQuestion_DisconnectedFunctions = DISTINCT( FilteringQuestion[Used_Function] )

 

Sergii24_0-1693229036828.png

 

Now, the measure:

 

Filter_Measure = 
VAR _DisconnectedFunction = VALUES( FilteringQuestion_DisconnectedFunctions[Used_Function] )            //get the list of fucntions to exclude
VAR _DisonnectedUsers =                                                                                 //get a table of 1 column of users who have values for currently selected disconnected function
    SELECTCOLUMNS(
        FILTER(
            ALL( FilteringQuestion[UserID], FilteringQuestion[Used_Function] ),
            FilteringQuestion[Used_Function] in _DisconnectedFunction
        ),
        "@Users", FilteringQuestion[UserID]
    )

RETURN 
    IF(
        SELECTEDVALUE( FilteringQuestion[UserID] ) in _DisonnectedUsers,
        1,
        0
    )

 

 

The final step is apply a visual level filter on both tables (Filter_Measure = 0 to the one on the left and Filter_Measure = 1 to the one on the right)

Sergii24_1-1693229313941.png

 

Let me know if it works as you expect 🙂

 

 

Anonymous
Not applicable

Hi Sergii24,

 

thanks for helping me out.

 

I need to expand the functionallity, to include a date filter in this page. 

 

In your solution we have the code part:

ALL( FilteringQuestion[UserID], FilteringQuestion[Used_Function] )

 

And I found out, because of this ALL() it is not filtering correctly. 

 

For example, if I select all users since beginn of this year, and the user "ABC" only used "Function_1", but before he used "Function_2". I also need to select on the right slicer "Function_2", then he shows me user "ABC". 

 

Hope my example is clear. Could you help me out again? 

 

Best regards

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors