Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Aqil_Shah
Frequent Visitor

Spend Buckets

Hi All,

 

I wanted to create spend buckets for spend by Name. However, I do not want to categorize the bucket by each line instead it will read total spend then it classifies which bucket it falls to. Also, I wanted to  use as column instead of measure so that I can display the buckets in chart.

 

Please refer my mock data below

Aqil_Shah_0-1688454617864.png

 

This is what I wanted to display

Aqil_Shah_1-1688454681468.png

 

Thank you!

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Bucket = var _sum = SUM('Table (32)'[Spend]) return

SWITCH(TRUE(),
_sum<50,"Less than 50",
_sum<100,"More than 50",
_sum>=100,"More than 100")

When placed in a table the result is like this:
ValtteriN_0-1688458327413.png

 

If you want a column here is an example of that:

Bucket_c = var _sum = CALCULATE(SUM('Table (32)'[Spend]),ALLEXCEPT('Table (32)','Table (32)'[Name])) return

SWITCH(TRUE(),
_sum<50,"Less than 50",
_sum<100,"More than 50",
_sum>=100,"More than 100")

ValtteriN_1-1688458531143.png

 


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Aqil_Shah ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Bucket = var _sum = SUM('Table (32)'[Spend]) return

SWITCH(TRUE(),
_sum<50,"Less than 50",
_sum<100,"More than 50",
_sum>=100,"More than 100")

When placed in a table the result is like this:
ValtteriN_0-1688458327413.png

 

If you want a column here is an example of that:

Bucket_c = var _sum = CALCULATE(SUM('Table (32)'[Spend]),ALLEXCEPT('Table (32)','Table (32)'[Name])) return

SWITCH(TRUE(),
_sum<50,"Less than 50",
_sum<100,"More than 50",
_sum>=100,"More than 100")

ValtteriN_1-1688458531143.png

 


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






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

Proud to be a Super User!




Hi @ValtteriN ,

 

That works like a charm! Thank you!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!