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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
jameshoneywill
Frequent Visitor

Buys product A and buys product B

Hi 

I have a nice bit of dax calculating how many customers buy A and B

Bought A AND B =
VAR ACust =
CALCULATETABLE(
    VALUES(fact_Sales[Company ID]),
    dim_product[Product] IN VALUES('Product A'[Product])
)
VAR BCust =
CALCULATETABLE(
    VALUES(fact_Sales[Company ID]),
    dim_product[Product] IN VALUES('Product B'[Product])
)
RETURN

COUNTROWS(INTERSECT(ACust,BCust))

The tables 'Product A' and 'Product B' are just duplicates of the dim_product table so users can have two slicers to pick which products they wish to combine. It's writen like this because I also have another DAX measure using Except instead of Intersect to show the customers buying A and not buying B, and I can combine the outputs on the same dashboard from the same slicers etc etc. 

What I want to do is add a matrix to the report showing the number of customers buying both, (Product A on the Y axis and Product B on the X). The issue I have is the dax obviously counts the customers where Product A = Product B i.e. total customers of Product A. and I would prefer this to be blank or failing that zero/0... is there something simple I can add to the code?

TIA

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Try using a graphical solution first, like a matrix or column chart visual. You may not need a DAX based solution.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.