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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
awff
Helper III
Helper III

Whitespace analysis dynamic slicer - Customer has X but not Y

Hello fellow PBI'ers,

 

I'm not sure how possible this is, but I want to build a white space analysis that will show a list of customers that have certain products and NOT other selected products based on two slicers that the user can choose. For example -

 

The user selects the following from the two slicers:

 

Customer bought [Slicer1: Apple, Orange] but NOT [Slicer2: Pineapple]

 

 

Sample order item data:

CustomerProduct
AApple
AOrange
BApple
BPineapple
BOrange
BPear
CMango
COrange
CBanana
CPear
CPineapple
DOrange
DApple
DBanana

 

From the above query, the result would be Customer A and D that match the query.

 

B does not appear because the second NOT condition is FALSE because they bought Pineapple.

 

C does not appear because the first condition is FALSE as customer only bought Orange and NOT Apple, C also bought Pineapple making the second condition FALSE

 

Has anyone done something like this that they provide help? I've only ever done this as static values but not as a type of dynamic slicer.

 

2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

View solution in original post

9 REPLIES 9
Ahmedx
Super User
Super User

my friend, forget about the whole solution and try this solution. I optimized everything

 

awff
Helper III
Helper III

@Ahmedx appreciate you helping on this. I definitely owe you one a big thank you...

 

I just tried to apply this on a greater data set but I am getting some strange results where there are repeated orders. I tried to simulate the issue using an expanded dataset below from the sample where the products orders may be repeated due to returning customers.

 

CustomerProduct
AApple
AOrange
BApple
BPineapple
BOrange
BPear
CMango
COrange
CBanana
CPear
CPineapple
DOrange
DApple
DBanana
EPear
EPear
EPineapple
EBanana
FApple
FMango
CPear
CPineapple
DOrange
DApple
DBanana
EPear
EPear
EPineapple
EBanana
FApple
FMango

 

In this case, customer D for example bought Apple and Orange but not Pineapple. The query should be true but does not seem to appear as a result. Same with repeating customers D, E and F. I tried to tweak the Flag DAX for awhile but no luck 😞 !

 

awff_0-1699517649296.png

 

and try this

m1 = 
VAR _tbl0 = SELECTCOLUMNS(FILTER(SUMMARIZE('Table','Table'[Customer],'Table'[Product]), 'Table'[Product]  in VALUES('sliser 2'[Product])),"Customer",[Customer])
VAR _tbl = FILTER(FILTER(ALLSELECTED('Table'[Customer],'Table'[Product]),  not 'Table'[Customer] in _tbl0),'Table'[Product] in VALUES('sliser 1'[Product]))
VAR _tbl2 = FILTER(ADDCOLUMNS(SUMMARIZE(_tbl,[Customer]), "rr", COUNTROWS(FILTER(_tbl, 'Table'[Customer]=EARLIER('Table'[Customer])))),[rr]=2)
RETURN  CONCATENATEX(_tbl2,[Customer],"-")

 

try again

 

Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

Hi @Ahmedx , thanks for your help! The "flag" filter works perfectly.

 

I just had a question with the "m1" measure. Is it meant to show the matching customers?

m1 = 
VAR _Count1 =  SELECTCOLUMNS(FILTER('Table','Table'[Product] in VALUES('sliser 2'[Product])),"Customer",[Customer])
VAR _Count2= SELECTCOLUMNS(FILTER('Table', 'Table'[Product] in VALUES('sliser 1'[Product])),"Customer",[Customer])
RETURN  CONCATENATEX(DISTINCT(EXCEPT(_Count2,_Count1)),[Customer],"-")

When I select the below example in the slicer, it returns A, B & D, which is correct if "Banana" was not selected. But in this case, It should just be D?

 

awff_0-1699486488475.png

 

pls try

 

👏Works perfectly now! Thank you!

Amazing, thank you so much! I would not have thought of doing it this way.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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