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

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
v-piga-msft
Resident Rockstar
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

 

 

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
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.