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
Mainer04401
Helper III
Helper III

Sales Volume Contribution Grouping (Similar to Quartiles)

I’m trying to do something similar to calculating percentile quartiles but instead of 25% of customers I want each “quartile” to consist of 25% of sales.  So, for example, I may see that the top 25% of sales volume comes from just 5 stores while the bottom 25% of sales volume comes from 100 stores.    

 

In Excel, I would sort the stores by sales volume in descending order, then add a column for cumulative contribution and a blank column for volume contribution bucket.  Stores with <= 25% cumulative contribution are labeled “Top 25% of Sales” in the volume contribution bucket column, stores with > 25% to <= 50% cumulative contribution are labeled “> 25% to <= 50% of Sales”, etc

Is there a way to do this in DAX / PowerBI? 

Below is an example from Excel:

CustomerDivisionSalesCumulative SalesCumulative % of Total SalesGrouping
AEast2502500.25Top 25% of Sales
BWes1003500.35Upper-Middle 25% of Sales
Central1505000.5Upper-Middle 25% of Sales
DEast1206200.62Lower-Middle 25% of Sales
EWes706900.69Lower-Middle 25% of Sales
FCentral607500.75Lower-Middle 25% of Sales
GEast608100.81Bottom 25% of Sales
HWes558650.865Bottom 25% of Sales
ICentral509150.915Bottom 25% of Sales
JEast409550.955Bottom 25% of Sales
KWes259800.98Bottom 25% of Sales
LCentral2010001 
  1000   

 

1 ACCEPTED SOLUTION
Mainer04401
Helper III
Helper III

After lots of trial and error, I figured out a way to do it.  

I created 3 new columns:

 

Cumulative Sales =
calculate([Sales Measure],
FILTER('Store List',
'Store List'[Sales] <= EARLIER('Store List'[Sales])))
 
All Sales Column =
calculate([Sales Measure],all('Store List'))
 
Sales Quartile =
if('Store List'[Cumulative Sales] <= (.25*[All Sales Column]),"Bottom Quartile",
if('Store List'[Cumulative Sales] > (.25*[All Sales Column]) && 'Store List'[Cumulative Sales] <= (.50*[All Sales Column]),"3rd Quartile",
if('Store List'[Cumulative Sales] > (.50*[All Sales Column]) && 'Store List'[Cumulative Sales] <= (.75*[All Sales Column]),"2nd Quartile","Top Quartile")))
 
 
This groups the stores into quartiles, each contributing 25% of sales, from least to greatest.

View solution in original post

5 REPLIES 5
Mainer04401
Helper III
Helper III

After lots of trial and error, I figured out a way to do it.  

I created 3 new columns:

 

Cumulative Sales =
calculate([Sales Measure],
FILTER('Store List',
'Store List'[Sales] <= EARLIER('Store List'[Sales])))
 
All Sales Column =
calculate([Sales Measure],all('Store List'))
 
Sales Quartile =
if('Store List'[Cumulative Sales] <= (.25*[All Sales Column]),"Bottom Quartile",
if('Store List'[Cumulative Sales] > (.25*[All Sales Column]) && 'Store List'[Cumulative Sales] <= (.50*[All Sales Column]),"3rd Quartile",
if('Store List'[Cumulative Sales] > (.50*[All Sales Column]) && 'Store List'[Cumulative Sales] <= (.75*[All Sales Column]),"2nd Quartile","Top Quartile")))
 
 
This groups the stores into quartiles, each contributing 25% of sales, from least to greatest.
v-yuta-msft
Community Support
Community Support

@Mainer04401 ,

 

You may try PERCENTILE.EXC function, please refer to blog below:

https://sqldusty.com/2018/08/31/calculating-quartiles-with-dax-and-power-bi/

 

Community Support Team _ Jimmy Tao

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

The problem is that percentile puts the same percent of stores in each quartile group.  I'm looking for a function that puts the same percent of sales volume in each quartile group.  

@Mainer04401 ,

 

Could you please clarify more details about "Sales volume" you mentioned?

 

Regards,

Jimmy Tao

@v-yuta-msft- Sales volume is total quantity of units sold.  I am trying to group stores by contribution to sales, top 25% of sales, upper-middle 25% of sales, lower-middle 25% of sales and bottom 25% of sales.  See my original post for details on how I would group the stores in Excel.  I'm trying to build this into PowerBI so that I can filter by geography and the quartile will update accordingly, i.e. stores that contribute the top 25% of sales in the filtered geography.  Thanks. 

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.