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
LWOLF
Regular Visitor

SELECTED VALUES IN TABLE

Hi all,

 

Could you please advice how to fix this issue?

I need to exclude customers that bought at least one of the selected products. My current solution works if you select only one product, however I need to make it work for multiple selection. thanks 🙂

LWOLF_0-1647882069750.png

My main table:

Customer IDProduct

1a
1b
1c
1d
2c
2d
2f
2j
3j
3a
4v
4c
4t
5a
5d
6f
6r
6d

 

slicer disconnected = VALUES(main[Product])
Customer concat = SUMMARIZE('main',main[Customer ID])

 

calculated column in the 'customer concat' table:

 

Product_Concat = 
 CONCATENATEX(
     FILTER(
         'main',
         'main'[Customer ID] = 'Customer concat'[Customer ID]),'main'[Product],
         " ; ",'main'[Product],
         ASC)

 

Measure :

 

Products_exclusion = 
VAR _customer = SELECTEDVALUE('main'[Customer ID])
VAR _custmomer_products = SUMMARIZE(FILTER('main','main'[Customer ID]=_customer),main[Product])
VAR _selected_products = ALLSELECTED('slicer disconnected'[Product])
RETURN
IF(
    ISFILTERED(
        'slicer disconnected'[Product]),
IF(     
    _selected_products  IN _custmomer_products,
    0,
    1
    ),
    1)

 

This is my main visual that needs to be filtered correctly based on the slicer selection.

LWOLF_1-1647882333786.png

data model: 

LWOLF_0-1647882500806.png

 

 

1 ACCEPTED SOLUTION

thanks @amitchandak . I actually managed to solve it after many hours of thinking! 😄 

 

Products_exclusion = 
VAR _table = CALCULATETABLE(SUMMARIZE('main','main'[Customer ID]), FILTER(ALL('main'),'main'[Product] IN FILTERS('slicer disconnected'[Product])))
RETURN
IF(
    ISFILTERED(
        'slicer disconnected'[Product]),
IF(     
    MAX('Customer concat'[Customer ID]) IN _table,
    0,
    1
    ),
    1) 

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@LWOLF , Make sure independent table for the product is used in slicer, I changed the name to product

 

try measure

 

Customer concat =
var _cust = except(all(main[Customer ID]) , SUMMARIZE(filter('main',main[Product] in VALUES(Product[Product])), main[Customer ID]))
return
countrows(filter(main, main[Customer ID] in _cust ))

 

plot this with customer

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks @amitchandak . I actually managed to solve it after many hours of thinking! 😄 

 

Products_exclusion = 
VAR _table = CALCULATETABLE(SUMMARIZE('main','main'[Customer ID]), FILTER(ALL('main'),'main'[Product] IN FILTERS('slicer disconnected'[Product])))
RETURN
IF(
    ISFILTERED(
        'slicer disconnected'[Product]),
IF(     
    MAX('Customer concat'[Customer ID]) IN _table,
    0,
    1
    ),
    1) 

 

@LWOLF , Kudos to You

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.