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
Wheaten22
Regular Visitor

Aggregating client sales and then bucketing and creating bar charts of the results

Hi,

 

My dataset contains thousands of rows of Orders which contain Client IDs and the amount they purchased for as well as about fifty other columns that are not important for what I am trying to do here.  

 

What I want to do is:

  1. Aggregate the sum of all sales by the client ID
  2. Bucket the aggregated spend by client (i.e. 0-10,000, 10,000 - 25,000, 25,000 - 50,000...)
  3. Show a bar chart of how many clients fall into each bucket.  

 

I have been able to do 1 & 2 multiple different ways and in a table it looks good, but when I try to display it in a graph, it is not coming out correctly.  The closest I have come is the bar chart working but it is counting each individual order and bucketing them instead of the aggregate by client.

 

Thanks in advance for your help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Please follow the below steps.

 

1. To aggregate the Amount based on Client ID

Group the Client ID column by applying SUM on the Amount column.

= Table.Group(#"Changed Type", {"Client ID"}, {{"Amount", each List.Sum([Amount]), type number}})

Aggregate.png

 

 

 

 

 

2. To create a bucket of Amount   -    Create a conditional column as below

= Table.AddColumn(#"Grouped Rows", "Bucket", each if [Amount] < 50 then "0 - 50" else if [Amount] <= 100 then "50 - 100" else if [Amount] > 100 then "100 - Above" else null)

Bucket.png

3. Using the newly created conditional column create a bar chart.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Please follow the below steps.

 

1. To aggregate the Amount based on Client ID

Group the Client ID column by applying SUM on the Amount column.

= Table.Group(#"Changed Type", {"Client ID"}, {{"Amount", each List.Sum([Amount]), type number}})

Aggregate.png

 

 

 

 

 

2. To create a bucket of Amount   -    Create a conditional column as below

= Table.AddColumn(#"Grouped Rows", "Bucket", each if [Amount] < 50 then "0 - 50" else if [Amount] <= 100 then "50 - 100" else if [Amount] > 100 then "100 - Above" else null)

Bucket.png

3. Using the newly created conditional column create a bar chart.

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.