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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors