cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RubenGA Frequent Visitor
Frequent Visitor

Classify customers based on consumption

Hi there! I have a model in which I group clients according to an identifier ("Class") this in the table customers on the other hand I have the table sales and here the transactions are registered by customer number I need to formulate a measure that compares the consumption and classify customers according to the group ("Class") as increment, decrement, etc. based on this comparison that in the first instance works but applies only at the client level and I require it by level ("Class") please guide me how to achieve it.

 

The measure I use is as follows:

Current.PNGDesired.PNG

=SWITCH(TRUE(),AND(CALCULATE(Sales[Consumo Anterior])>0,CALCULATE(Sales[Consumo Actual])>0),
                    SWITCH(TRUE(),
                    CALCULATE(Sales[Consumo Anterior])>CALCULATE(Sales[Consumo Actual]),"Decremento",
                    CALCULATE(Sales[Consumo Anterior])<CALCULATE(Sales[Consumo Actual]),"Incremento",
                    CALCULATE(Sales[Consumo Anterior])=CALCULATE(Sales[Consumo Actual]),"Sin Crecim.",
                    BLANK()),
        AND(CALCULATE(Sales[Consumo Anterior])<=0,CALCULATE(Sales[Consumo Actual])>0),
                    SWITCH(TRUE(),
                    CALCULATE(Sales[Consumo Anterior])<CALCULATE(Sales[Consumo Actual]),"Nuevo",
                    BLANK()),
        AND(CALCULATE(Sales[Consumo Anterior])>0,CALCULATE(Sales[Consumo Actual])<=0),
                    SWITCH(TRUE(),
                    CALCULATE(Sales[Consumo Anterior])>CALCULATE(Sales[Consumo Actual]),"Perdido",
                    BLANK()),
        AND(CALCULATE(Sales[Consumo Anterior])<=0,CALCULATE(Sales[Consumo Actual])<=0),"Sin Mov",
        BLANK())
1 REPLY 1
Community Support Team
Community Support Team

Re: Classify customers based on consumption

Hi @RubenGA ,

Based on your formula, I could understand your logic and I'm afraid that the result should be right based on your measure

To get your solution quickly, if it is convenient, could you share some data sample which could reproduce the scenario with table format so that i could copy and have a test on it?

In addition, you'd better describe your logic again so that I can understand better to write the formula.

Best  Regards,

Cherry

 

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 399 members 3,555 guests
Please welcome our newest community members: