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! Request now

Reply
leok311
Regular Visitor

Selecting customers with some values but not others.

If I have a dataset as below, and I want the user to be able to select customerID (customers) who have some products but not other products.

For example, I would like the user to see all customers who have Prod1 and no other Prod. In this case it would be customers 456, 789, 100. 

Another example is customers who have Prod1 AND/OR Prod2 only, CustomerID 456, 789,100

 

CustomerIDProduct
123Prod1
123Prod2
123Prod3
456Prod1
456Prod2
789Prod1
100Prod1

 

Is there a way to do this?

One way would be to convert this long table into wide table and have a column for each product, has_Prod1, has_Prod2 etc. Would this be the simpliest way of doing it?

 

Thank you.

5 REPLIES 5
Anonymous
Not applicable

Hi @leok311 ,

 

Is my follow-up just to ask if the problem has been solved?

If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?

Thank you very much for your cooperation!

Anonymous
Not applicable

Thanks for the reply from Selva-Salimi, please allow me to provide another insight.
Hi @leok311 ,

You can use the following DAX to create a measure to calculate the number of rows that have other products.

HaveOtherProducts = 
VAR _SelectedValues = CALCULATETABLE(VALUES('Table'[Product]),ALLSELECTED('Table'[Product],'Table'[CustomerID]))
VAR _rowsWithOtherProducts = CALCULATE(COUNTROWS('Table'),Not 'Table'[Product] IN _SelectedValues)
RETURN
_rowsWithOtherProducts

 

Add this measure to the filter pane of the table visual, set it to "is blank".

The final result is as follows, hopefully it will meet your needs.

vdengllimsft_0-1732000679234.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Selva-Salimi
Super User
Super User

Hi @leok311 

please let me know that the products are selected by user on slicer? and also how many products did you have? would you like to calculate for any selection of subset of products?

Yes I would like to have the user select which products the customer should have using a slicer.

Let's say I have 5 products.  I would like to expand the possible solution to other Categorical columns.

With regards to subsets, I'm hoping for something that allows the user to have any combination of products. 
The products would be listed in some filter, and use selects which they want a customer to have and leave out any they don't want them to have. 
Hope that makese sense. thank you

You can write a measure as follows:

 

Measure = var tbl = SUMMARIZE(all('Table'),'Table'[CustomerID],"X",distinctcount('Table'[Product]))
var tbl2 = summarize('Table','Table'[CustomerID],"Y",DISTINCTCOUNT('Table'[Product]))
var tbl3=ADDCOLUMNS(tbl,"new column", MAXX(tbl2,[Y]))
return
maxx(filter(tbl3,'Table'[CustomerID]=SELECTEDVALUE('Table'[CustomerID]) && [X]=[new column]),[new column])
 
for the visualization select table visual and add customerIDs and then in the filter pane add this measure and set it to "is not blank". as follows:
SelvaSalimi_0-1731891452188.png

 

If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly.

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
Top Kudoed Authors