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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.