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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
melvincv
Frequent Visitor

dax table: list of customers who did not buy a particular product line

Hi,

 

I'm still learning table functions, so please help me...

 

I have the following columns in my data table:

Invoice No.

Customer Name

Product Line - A, B, C, D, E

Revenue

 

 

I need a DAX table formula to get a column with the list of Customers who did not buy a particular product line (B)

 

I tried this

ZeroCustomers = SUMMARIZECOLUMNS('US Sales'[CustomerName],'US Sales'[Productline],FILTER('US Sales','US Sales'[Productline]<>"B"))

 

But it gives me the customers who bought B also...

 

Please help me at the earliest.

 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@melvincv wrote:

Hi,

 

I'm still learning table functions, so please help me...

 

I have the following columns in my data table:

Invoice No.

Customer Name

Product Line - A, B, C, D, E

Revenue

 

 

I need a DAX table formula to get a column with the list of Customers who did not buy a particular product line (B)

 

I tried this

ZeroCustomers = SUMMARIZECOLUMNS('US Sales'[CustomerName],'US Sales'[Productline],FILTER('US Sales','US Sales'[Productline]<>"B"))

 

But it gives me the customers who bought B also...

 

Please help me at the earliest.

 


@melvincv

You can try to create a calculated table as

Product = VALUES(Table1[Product Line])

and a measure as

Not Purchase the selected Product =
IF (
    ISFILTERED ( 'Product'[Product Line] )
        && HASONEVALUE ( 'Product'[Product Line] )
        && COUNTAX (
            FILTER (
                Table1,
                Table1[Product Line] = LASTNONBLANK ( 'Product'[Product Line], "" )
            ),
            Table1[Customer Name]
        )
            >= 1,
    FALSE (),
    TRUE ()
)

Capture.PNG

 

See more details in the attached pbix.

View solution in original post

4 REPLIES 4
Eric_Zhang
Microsoft Employee
Microsoft Employee


@melvincv wrote:

Hi,

 

I'm still learning table functions, so please help me...

 

I have the following columns in my data table:

Invoice No.

Customer Name

Product Line - A, B, C, D, E

Revenue

 

 

I need a DAX table formula to get a column with the list of Customers who did not buy a particular product line (B)

 

I tried this

ZeroCustomers = SUMMARIZECOLUMNS('US Sales'[CustomerName],'US Sales'[Productline],FILTER('US Sales','US Sales'[Productline]<>"B"))

 

But it gives me the customers who bought B also...

 

Please help me at the earliest.

 


@melvincv

You can try to create a calculated table as

Product = VALUES(Table1[Product Line])

and a measure as

Not Purchase the selected Product =
IF (
    ISFILTERED ( 'Product'[Product Line] )
        && HASONEVALUE ( 'Product'[Product Line] )
        && COUNTAX (
            FILTER (
                Table1,
                Table1[Product Line] = LASTNONBLANK ( 'Product'[Product Line], "" )
            ),
            Table1[Customer Name]
        )
            >= 1,
    FALSE (),
    TRUE ()
)

Capture.PNG

 

See more details in the attached pbix.

bsas
Post Patron
Post Patron

Hi,

 

You can use function IF [e.g IF(and(Product Line="B",revenue<>0 "or you can use >0"),Customer Name,"")

 

I do not know whether you have two categories in 1 column.

melvincv
Frequent Visitor

How do I exclude the values of the Customer Name column?

 

I have

Table1 - CustomerName, Product Line

Table2 - CustomerName, Product Line

 

I need Table3 with Table1[CustomerName] - Table2[CustomerName]

What infor should be represented in these 2 tables (1 and 2)?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.