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

Create Custom Groups based on Spend

Hi all,

 

I am trying to create custom groups based on customer spend per year, please see image. Is there a way to dynamically do this.Capture.PNG

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

Is this what you want?

group.PNGgroup2.PNG

If so, you can create your column and measure like so:

column:

Customer Bucket = 
VAR sum_sales =
    CALCULATE (
        SUM ( 'Table'[Net Sales] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer], 'Table'[Year] )
    )
RETURN
    IF ( sum_sales < 10000, "0-10K", IF ( sum_sales >= 10000, "10K+", BLANK () ) )

Measure:

Sum sales of each Customer = SUM ( 'Table'[Net Sales] )

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Nathaniel_C
Super User
Super User

Hi @Anonymous ,

Have you tried using a SWITCH?

Let me know if you have any questions. https://docs.microsoft.com/en-us/dax/switch-function-dax

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

SWITCH(
               TRUE(),
                table [Net Spend] >20000,"Champions",
                table [Net Spend] >10000, "Winners")

note: The SWITCH() stops as soon as something is true, therefore if the [Net Spend] is greater than 20k, it stops there an returns Champions.




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

Proud to be a Super User!




Anonymous
Not applicable

Hi @Nathaniel_C , thanks for the answer. This doesn't seem to be working. Please see attached. I am struggling to have only those customers each year who spend the amount in certain tier, switch is calculating something different.

 

Capture.PNG

@Anonymous ,

So, it has to be a certain threshold that is met every year, and if not met in any year, then they don't qualifiy? So one year, they could be a champion, but the next year they don't spend enough then they drop off regardless of how much they spent in the past? If that is true, we could do a test on each year. An easy way is to assign a number to each level, say a champion is 5, and then it goes down from there 4 3 2 1 0.  Then we could simply get the min from all their year numbers. Does sound right?

 

BTW I cannot tell what the picture is showing me...the arrow means what?  When you post online, there are so many chances to misunderstand, it is good to really spell it out.  I know you are trying to get this done as quickly as possible, but we are not paid for this, so make it easy on us.

 

Thank you.

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





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

Proud to be a Super User!




Anonymous
Not applicable

Hi @Nathaniel_C ,

 

Sorry for the confusion, it is exactly what you mentioned. It has to be a certain threshold that is met each year. The customers can be 50k+ 1 year and could be 10k+ the next year. In the picture above what I wanted to communicate was that those customers should be in the tier above because they had more than 10k in sales that year.

 

Here is what I want, lets assume customer A had 10k+ sales in 2018 and 1k-5k sales in 2019, I want customer A to populate in both 10k+ tier with 2019 as 0 and 1k-2k tier with 2018 as 0.

 

let me know if this makes sense.

 

Thanks!

@Anonymous ,

Thank you for your response. Would you also supply us with an expected outcome.  You could dummy it up in Excel if you want.  That gives the target.

Thanks,

Nathaniel





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

Proud to be a Super User!




Anonymous
Not applicable

Hi @Nathaniel_C ,

 

My data is structured as below with multiple rows of sales by each year:

CustomerNet SalesYear
A50002018
B20002019
C3002019
D40002018
E2002018
F100002019
A500002019
B1002018
C100002018
D80002019
E500002019
F1002018
A2002019
B50002018
C500002019
D50002019

 

I need my output to be drilldown of the groups based on spend for example if customer A spent 5000 in 2018 and 50200 in 2019 it will be populated under different tiers of 0-10k for 2018 and 10k+ for 2019 as below

 

Customer Bucket 20182019
10k+A 50200
 C1000050300
 D 13000
 E 50000
 F 10000
0-10KA5000 
 B51002000
 D4000 
 E200 
 F100 

 

Let me know if this makes sense, thanks!

 

Icey
Community Support
Community Support

Hi @Anonymous ,

Is this what you want?

group.PNGgroup2.PNG

If so, you can create your column and measure like so:

column:

Customer Bucket = 
VAR sum_sales =
    CALCULATE (
        SUM ( 'Table'[Net Sales] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer], 'Table'[Year] )
    )
RETURN
    IF ( sum_sales < 10000, "0-10K", IF ( sum_sales >= 10000, "10K+", BLANK () ) )

Measure:

Sum sales of each Customer = SUM ( 'Table'[Net Sales] )

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Icey ,

 

Thanks for this, this is great 🙂

Hi @Anonymous ,

 

Tell me if this works for you. Which bucket?

bucket.PNG


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





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

Proud to be a Super User!




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.