cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

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
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
Super User

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors