Percentile in calculated column

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I want to classify spend by percentile in a column so I can filter against it. Hoping someone has experience in creating such a column.

We have pay dates (Mondays) and I want to classify all vouchers to be paid that day for vendors as to whether the vendor itself fits under the (say) 30th percentile of spend for that pay cycle.

Sample data
VendorVoucherPay DatePayment AmountUnder 30 Pct
123​
A01
13-Apr​
$50​
Y
123​
A02
13-Apr​
$100​
Y
123​
A03
13-Apr​
$30​
Y
456​
B01
13-Apr​
$100​
456​
B01
13-Apr​
$90​

The process is
a) to get the total payment amount of all vouchers paying on April 13th.
b) to get the sum of payments for each vendor
c) rank the vendor payments from least to most expensive
d) get the cumulative payment from the least expensive, and if a vendor total payment when added to the cumulative total is under the 30th percentile to put a "Y" in the percentile column.

So in this example let's say the total payment for April 13th is $5,000 so every vendor total under the 30th percentile adds up to no more than $1,500 starting with the smallest vendor.
Vendor 123 has $180 to be paid. When added to all the other smaller vendor total payments the cumulative total is $1,499. Each of those vouchers for the vendors in that list will have a "Y" in the Under 30 Pct column.
Vendor 456 with a total of $190 pushes over the 30th percentile and thus doesn't qualify.

Yes, this would be more feasible as a measure, but this flag we're creating is just one of several ways to slice the payments and we'd like to filter. We have about 7 "levels' of vendor payments we'd like to categorize and be able to filter by levels to see what payment characteristics show up in our pay cycles.

So the total for all vouchers and collecting the sum total for the particular vendor in the row is easy enough, but ranking all the others and then determining the cutoff has me scratching my head.

I'm thinking the process would be to do an ADDCOLUMN with the ranked vendor totals, limit the rows to those vendors under the limit, then test the current row to see if the vendor ID is in the ADDCOLUMN group. But that's beyond my current skill set.
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi MacFuller,
have you tried SUMIFS? Basically you want SUMIFS(amounts,paydate=row_paydate,vendor=row_vendor) -> the total pay of that vendor for that day. Divide by: SUMIFS(amounts,paydate=row_paydate) -> gives you the percentage of that days pay that is for that vendor. See for a tutorial on SUMIFS e.g.: How to use the Excel SUMIFS function | Exceljet
Hope that helps,
Koen
 
Upvote 0
Thanks, but I'm looking for a DAX solution. I've got almost 5 million rows of vouchers!
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top