Forum Discussion
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:
=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
- v-piga-msft
Resident Rockstar
Hi Anonymous ,
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