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
Anonymous
Not applicable

Customer Classification

Hi all, I'm trying to implement the following login to classify customers in a new column but need some help.

 

PREMIUM : if all the Cloud products of a customer are 10 

PREMIUM ELIGIBLE : if all products (any Product Type) of a customer are in range : >= 5 and <10

NOT ELIGIBLE : if customer has any product < 4 (any Product Type)

PREMIUM PLUS : customers with products  > 11 (any Product Type)

 

Customer IDProduct TypeProductCustomer Type (desired column)
ACloud10Premium
ACloud10Premium
BCloud5Premium Eligible
BData Center9Premium Eligible
CData Center3Not Eligible
CData Center9Not Eligible
DCloud11Premium Plus
DCloud11Premium Plus
2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product]<4))>0,"Not eligible",if(AND(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product Type]="Cloud"))*Data[Product]=CALCULATE(SUM(Data[Product]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product Type]="Cloud"&&Data[Product]=10)),CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product Type]="Cloud"))>0),"Premium",if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product]>=5&&Data[Product]<10))>0,"Premium Eligible","Premium Plus")))

Hope this helps.

Untitled.png


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

View solution in original post

v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Per your request,the calculated column is as below:

 

Customer Type =
VAR c =
    CALCULATE (
        MIN ( 'Table'[Product] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer ID] )
    )
VAR d =
    CALCULATE (
        MAX ( 'Table'[Product] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer ID] )
    )
RETURN
    IF (
        'Table'[Product] = 10,
        "PREMIUM",
        IF (
            c >= 5
                && d < 10,
            "PREMIUM ELIGIBLE",
            IF (
                c <= 4
                    && d > 4,
                "NOT ELIGIBLE ",
                IF ( d >= 11, "PREMIUM PLUS ", BLANK () )
            )
        )
    )

 

 

Finally you will see:

Annotation 2020-04-10 161704.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Per your request,the calculated column is as below:

 

Customer Type =
VAR c =
    CALCULATE (
        MIN ( 'Table'[Product] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer ID] )
    )
VAR d =
    CALCULATE (
        MAX ( 'Table'[Product] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer ID] )
    )
RETURN
    IF (
        'Table'[Product] = 10,
        "PREMIUM",
        IF (
            c >= 5
                && d < 10,
            "PREMIUM ELIGIBLE",
            IF (
                c <= 4
                    && d > 4,
                "NOT ELIGIBLE ",
                IF ( d >= 11, "PREMIUM PLUS ", BLANK () )
            )
        )
    )

 

 

Finally you will see:

Annotation 2020-04-10 161704.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product]<4))>0,"Not eligible",if(AND(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product Type]="Cloud"))*Data[Product]=CALCULATE(SUM(Data[Product]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product Type]="Cloud"&&Data[Product]=10)),CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product Type]="Cloud"))>0),"Premium",if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Product]>=5&&Data[Product]<10))>0,"Premium Eligible","Premium Plus")))

Hope this helps.

Untitled.png


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

@Anonymous hey isn't we did similar in other post?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.