SUMIF staff sales bonus index based on product rank - google-sheets-formula

I want to develop staff sales bonus index in google sheets based on product rank. So if the staff sells one brick their bonus index will be 1 and if they sell 1 cement bag, their bonus index will be 1200.
Here is the list of products with weightage of each product.
Following is the list of sales from which need to construct index.
Here is the list of staff with correctly calculated Bonus Index but with poor formula;
Here is my current formula in cell B2
=sumifs(K:K,H:H,A2,J:J,E$2)*F$2+sumifs(K:K,H:H,A2,J:J,E$3)*F$3+sumifs(K:K,H:H,A2,J:J,E$4)*F$4
As you can see there is issue with above formula that we need to add a sumifs for each product, so if there are 100+ products, this formula won't work.
Can above formula be combined to one single condition? May be possible with arrays but I am not good with arrays or may be some other way?
Thanks for help

You can use SUMPRODUCT function:
=SUMPRODUCT((A2=$H$2:$H$16)*(TRANSPOSE($E$2:$E$4)=$J$2:$J$16)*TRANSPOSE($F$2:$F$4)*$K$2:$K$16)

Related

How to recalculate the percentages from total when filtering in Power BI?

As I am not really sure how to express myself, I'll better demonstrate what I need to be done.
This is a sample DB.
You see here
that we have a category slicer and on the table is show the percentage of sales for a given product and its description.
On the next photo I used the slicer to filter the products on the "16GB" category. My task is when filtering, the total of the % to show 100% and the distinct products to show the percentage of this total (as part of the category, not of all other products and categories).
Thank you in advance!
You need to have a raw amount in your dataset. I was able to do this using this sample data.
Then for both table visuals in Power BI, you should select show value as percent of grand total for the amount value. This will allow Power BI to calculate the percentages dynamically as the filter criteria from the slicer changes.
Here is the result.

Combination of orders and suppliers

So i have the following situation.
I want to find all possible combination of product order at an amount of suppliers.
Lets say i have 3 products
Product G
Product S
Product X
Now lets say i have 3 suppliers
Supplier A
Supplier B
Supplier C
What are all possible combinations of orders? Im not really a math genius so i tried writing them out (27 combinations):
However im at a loss how to calculate this without writing it out like i did.
Im sure there is an algorithm or simple calculation for this.

Select products to get maximum cart value

Given a list of products available in the store, i need to select set of products to my cart in such a way that, my cart value should be maximum it can.
Restrictions are like, cart has a dimension l*w*h. Products selected should individually and totally fit into the cart giving maximum possible value to cart. One 1 item per product can be selected.
I have product id, price, l, w, ht, weight of each product with me. How can this be accomplished???
I came up with a logic as below.
Calculate volume of the cart
Calculate volume of product and value of product per cubic cm using its price
Sort the product list based on value/cucm
Start adding products from the sorted list like 1st, 2nd , 3rd, etc. till the cart gets filled.
If a product cannot fit into the cart, skip it and select the next possible product from the sorted list.
Once list is obtained, check if any product in the selected list can be replaced with another product with less volume but results in more cart value.
But this is not getting me the correct product list with maximum cart value. What is the problem in the above logic?
Are the three dimensions integer valued with some finite bound ? Then it can be solved with dynamic programming. But I think there should some assumptions made, e.g. the partition of sub-problems should be end-to-end cutting planes etc. Without that dynamic programming would be infeasible.
The key trick here is that you need to account for possibilities that a box can be oriented in several ways, and it is the number of ways to align its own three dimensions along the three axes of the cart. It is 3! = 6 for three dimensions. So in the dynamic programming when you process the i-th product, include all the 6 ways interpret its 3 dimensions as L,W,H.

Simulating amazon.com best seller for books

I was just going through amazon.com and an interesting thing that caught my eye is how they calculate best sells in books.
I was thinking of writing a sample program to calculate this. I was thinking that suppose i am calculating best sellers for the month than just sum the sales count of the individual books and show the top 10. Is it ok or am I missing something?
EDIT
One more interesting thing can happen: suppose one book having id1 was sold 10 pieces on first day but after that it has not been sold but book having id2 is getting sold for 1 or 2 pieces regularly. So how it would affect the best seller calculation. Thanks.
Sounds about right. Depends on how exactly you want to define it.
"best sellers" is the number of units sold.
Another way to do it, if you don't want to fix it to one month is to have some distribution function (like square decay, t^2) and add the counts weighted by the distribution function.
This way, even though you don't have a fixed timed window you look at both new comers and old books. Your function should look like this:
for a_book in books:
score = 0
for a_sale in sales[a_book]:
score += 1 / (days(now() - a_sale.time()) ** 2) # pow 2
I think you get the idea. You can try different functions like exp(days) or different powers. Experiment and see what makes sense for you.

How do I sort an Excel 2010 pivot table based on a subset of the data it contains?

I have an Excel 2010 pivot table that has categories and a count measure as the data. Those categories then have a date dimension nested underneath, filtered to show only the last two months.
When I sort the categories, I am sorting them by the total of the count measure across both June and July, in descending order.
Can anyone suggest how I can sort the categories based on the June data alone, as opposed to the total for both June and July?
Thanks!
Your questions is not related to Sql Server Analysis Services. SSAS provides multidimensional data that is also used by pivot tables as datasource. So that's why you have seen pivot table questions here. But they are not Excel related.
Anyway, i want to try to answer your question. As far as i understand your question, changing the order of the dimensions in your pivot table will be sufficient to achieve your goal. Add the date dimension to the pivot table first and then the category dimension to get your data grouped by date (month). You may then sort by categories to get the result you want.
Hope this help.

Resources