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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.