cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Classify customer based items purchased

I'd like to be able to classify, and then filter customers in a report based on what they purchased. My customer criteria is:
1. if a customer has only purchased Standard products, then they are a "Standard" customer

2. if a customer has only purchased Classic products, then they are a "Classic" customer

3. if they purchased both Classic and Standard products, then they are a "Both" customer

4. if they purchased a Premium product, then they are a "Premium' customer

 

In this case, customer A = Standard, customer B = both, customer C = Classic, customer D = Premium. I want to create a calculated column stating the type of customer they are (Standard, Classic, Both, or Premium)

 

Any suggestions on how to accomplish this? Thank you!

CustomerProduct BoughtCustomer Type (desired column)
AStandardStandard
AStandardStandard
AStandardStandard
BClassicBoth
BStandardBoth
BClassicBoth
CClassicClassic
ClassicClassic
DPremiumPremium

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

@jack421 ,

In such a case better to make it as the column, find the attached file.

 

Appreciate your Kudos.

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

10 REPLIES 10
Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

@jack421 ,

try all 4 as measures

all= calculate(distinctCOUNT(table[Product Bought]))
Standard =calculate(distinctCOUNT(table[Product Bought]),	Product Bought="Standard")
Classic =calculate(distinctCOUNT(table[Product Bought]),	Product Bought="Classic")

flag =
Switch(true(),
[all]=[Standard],"Standard",
[all]=[Classic],"Classic",
"Both"
)

 


Appreciate your Kudos.

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

Hi,

Write this calculated column formula

Category = if(CALCULATE(DISTINCTCOUNT(Data[Product Bought]),FILTER(Data,Data[Customer]=EARLIER(Data[Customer])))=1,Data[Product Bought],"Both")

Hope this helps.

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Highlighted
Helper III
Helper III

Re: Classify customer based items purchased

Hi @Greg_Deckler , thanks for your response! Could you take a look at my modified post? I actually realized I want to create a calculated column called Customer Type (standard, classic, both, or premium). Please let me know if you know of a way to do this in Power BI. 

 

Highlighted
Helper III
Helper III

Re: Classify customer based items purchased

Hi @Ashish_Mathur, thank you for the response. With your solution I was unable to type in a table column after the Earlier function for some reason. Could you also take a look at my edited post and see if your potential solution might be any different than your original post?

 

Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

@jack421 ,Please find the attached solution using measures

Screenshot 2020-03-15 11.01.37.png

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Helper III
Helper III

Re: Classify customer based items purchased

Thanks @amitchandak! One last thing - how would I create a filter using the Customer Type Recal measure? I want to know how many customers there are, and the breakdown by customer type. 

 

Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

@jack421 ,

In such a case better to make it as the column, find the attached file.

 

Appreciate your Kudos.

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Classify customer based items purchased

@jack421 You can create a column like this:

 

Customer Type = 
    VAR __Table = 
        SUMMARIZE(
            FILTER(
                'Table',
                [Customer] = EARLIER([Customer])
            ),
            [Product Bought]
        )
RETURN
    SWITCH(TRUE(),
        "Premium" IN __Table,"Premium",
        "Standard" IN __Table && "Classic" IN __Table,"Both",
        "Classic" IN __Table,"Classic",
        "Standard" IN __Table,"Standard"
    )

 

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors