Calculating Top Item Drivers Using Running Total

bravo1563

New Member
Joined
Dec 25, 2013
Messages
20
Hello
I am trying to return a list of products as my values for whatever time period I have selected, that makes up the top 50% of volume. I want the ability to be able to show multiple weeks on a visual but be able to see by item what's driving sales each week and how often they're the top drivers throughout the year. If the top 4 items account for 49.999% I still want it to return the 5th item, needs to return at least 50% of volume. I tried doing a rankx first as a variable and then a calculate but was having issues getting it to work correctly. Please see the below example, any ideas or thoughts would be greatly appreciated!

Input
ProductIDSales $Week% OF Total
C
91​
1​
20%​
I
84​
1​
19%​
B
77​
1​
17%​
D
64​
1​
14%​
G
45​
1​
10%​
A
27​
1​
6%​
H
26​
1​
6%​
E
21​
1​
5%​
F
15​
1​
3%​
B
99​
2​
18%​
D
99​
2​
18%​
F
96​
2​
18%​
C
84​
2​
15%​
A
63​
2​
12%​
H
42​
2​
8%​
E
41​
2​
8%​
G
14​
2​
3%​
I
8​
2​
1%​




Output (If Viewing Week 1)
ProductID
C
I
B



Output (If Viewing Week 2)
ProductID
B
D
F
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi

In developing my solution to your problem, I assume that:
-you are using Office 365
-your data is sorted by Week and then % (highest to the lowest ) as it is now.

1623799534761.png


Create a helper column and enter the following formula in the E2 and copy it down

=SUMIFS($D$2:$D$19,$C$2:$C$19,B$30,$E$2:$E$19,">0",$A$2:$A$19,$A31)

Then A24, enter the following formula for week 1

=FILTER($A$2:$A$19,($C$2:$C$19=B23)*($E$2:$E$19<>""))

Enter the following formula in B2

=XLOOKUP(A24#&B$23,$A$2:$A$19&$C$2:$C$19,$D$2:$D$19)

Repeat the last two steps for other weeks.

Alternative presentation be in a table as shown below. it will enable to you look at the trend over weeks.

1623800001741.png


If so, enter the following formula in B31 and copy it down and across. This solution does not require Office 365

=IF(SUMIFS($D$2:$D$19,$C$2:$C$19,B$30,$E$2:$E$19,">0",$A$2:$A$19,$A31)=0,"",SUMIFS($D$2:$D$19,$C$2:$C$19,B$30,$E$2:$E$19,">0",$A$2:$A$19,$A31))

Kind regards

Saba
 
Upvote 0
Hi

In developing my solution to your problem, I assume that:
-you are using Office 365
-your data is sorted by Week and then % (highest to the lowest ) as it is now.

View attachment 40862

Create a helper column and enter the following formula in the E2 and copy it down

=SUMIFS($D$2:$D$19,$C$2:$C$19,B$30,$E$2:$E$19,">0",$A$2:$A$19,$A31)

Then A24, enter the following formula for week 1

=FILTER($A$2:$A$19,($C$2:$C$19=B23)*($E$2:$E$19<>""))

Enter the following formula in B2

=XLOOKUP(A24#&B$23,$A$2:$A$19&$C$2:$C$19,$D$2:$D$19)

Repeat the last two steps for other weeks.

Alternative presentation be in a table as shown below. it will enable to you look at the trend over weeks.

View attachment 40863

If so, enter the following formula in B31 and copy it down and across. This solution does not require Office 365

=IF(SUMIFS($D$2:$D$19,$C$2:$C$19,B$30,$E$2:$E$19,">0",$A$2:$A$19,$A31)=0,"",SUMIFS($D$2:$D$19,$C$2:$C$19,B$30,$E$2:$E$19,">0",$A$2:$A$19,$A31))

Kind regards

Saba
Hello Saba
Sorry I should have clarified I need this in Dax for power bi.
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,107
Members
452,302
Latest member
TaMere

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