Calculate Max from set of Calculated Measure in powerPivot - max

I have created a model in PowerPivot, and have many calculated measure to get the share value (%).
EX:
1. Brand 1 15%
2. Brand 2 34%
3. Brand 3 51%
To get each brand Share value i have written a Dax formula as below:
=(Sum(Column A)/Sum(Column b)).
Now i need to get the max of the share value (%) from the list of Brands we have. Can someone help me write another formula to get the max of share Value among all the brands.
i.e. Brand 3 51%.

Without knowing more about your model I can only propose to try measure below (if measure for brand shares is called ValueShare).
MaxShare = MAXX(ALL('Product'[Brands]),[ValueShare])

Related

Subtracting multiple cells on Google Sheets + the use of IF ELSE

It's been weeks since I've been trying to solve this problem, I tried various formulas for this (ArrayFormula, ABS, SUMPRODUCT, using a negative sign on the cells), but I can't seem to get it right.
The correct way will always be manually subtracting the cells one by one but this will cause too much delay or problem if we have more than 100 rows on the sheets.
=if(D14<(E3-E4-E5-E6-E7-E8-E9-E10-E11-E12-E13),D14,E3-E4-E5-E6-E7-E8-E9-E10-E11-E12-E13)
Here's the link to the sheet: https://docs.google.com/spreadsheets/d/1fAPQHKupKglBAJpoxrcVqWP343m0P5QOj8zp1FvasEA/edit?usp=sharing
The overall idea for this is that the Total Purchased should be compared to the total sold. The 2201 value on the total sold is retrieved from another transactions sheet and it just totals every sold item, and then starting from E4 (170 in cell value) onwards, it decreases since we just need to know the number of sold items from that certain row.
Thank you very much for taking the time to read this. I'm looking forward to getting help from this as this stresses me for weeks now.
use cumulative function
=arrayformula(mmult(1*(transpose(row(D4:D))<=row(D4:D)),if(D4:D="",0,D4:D)))
and include in your formula in E4 as follows
=arrayformula(if(D4:D<($E$3-(mmult(1*(transpose(row(D4:D))<=row(D4:D)),if(D4:D="",0,D4:D)))),D4:D))

AWS Quicksight - Top10 offices by REVENUE divided by REVENUE

Is there a way to make a metric in Quicksight that is the ratio between TOP10 offices by REVENUE divided by REVENUE.
Thanks
The problem is that if I apply a filter to select the TOP10 offices by revenue in the numerator, the same filter is the apply to the denominator.
It was not clear from your question exactly what you meant by "ratio between TOP10 offices by REVENUE divided by REVENUE" but I have assumed you wanted the TOP N real total revenue by Store alongside the "ratio" or percent of total revenue of ALL revenue, not just the TOP N stores revenue.
To do this you can use the following calculated fields.
Make a calculated filler field to 'partition' by; that is you can use it to make a single partition of the whole data set, e.g. "single_partition_filler":
ifelse(isNotNull(store),1,0)
Make the ratio calculation you want, "Revenue over Total Revenue". The trick here is to use the "PRE_FILTER" aggregation level in the Table calculations so you are getting the sum of revenue by store PRE_FILTER divided by the sum of revenue by all stores (using the filler column) PRE_FILTER:
sumOver(revenue,[store],PRE_FILTER) / sumOver(revenue, [{single_partition_filler}], PRE_FILTER)
Make a table with "Store","Revenue (Sum)" and "Revenue over Total Revenue (Min)" and using a TOP N Filter for Store by Revenue (Sum). See Quicksight example below:
Compare with the same table unfiltered below:
Dataset used:
store,revenue
A,100
B,50
C,40
D,70
E,60
A,35
C,80

What is the percentage of this algorithm?

I need help determining the percent chance an item has to be picked by my algorithm. Essentially I created a hashmap of different items and then added an integer as the value to make some items less likely to appear. The way my algorithm works is by generating a random number between 0 and the size of the map. Then it will roll another random number between 1 and that chosen items assigned value. If that value matches the rolled number it will be added to an array. Also keep in mind this algorithm chooses 3 items out of the map and all 3 must be different so what is the percent chance each item will be chosen? Obviously you would need to know how many items there are and the associated values with each item but I can do that on my own I just want to know a general process for finding these percent's. Also after I figure out the percent each item has of showing up in the final set of 3 items I also need to take into account that those 3 items only have a 40% chance of showing up at all.
The first step is to figure out the percent chance each item has of showing up in the final 3 and the last step is to determine the chance those final 3 items have of showing up at all. I was thinking I could divide 3 by the maps total size (for example 20) which would give me a 15% chance of landing on each item before taking into account their assigned values in the map but where do I go from there because I am kind of getting lost with all these different things I need to take into account.

Rating System with Elo, better alternatives?

I'm working on a rating algorithm. I have a set of exercises. They are all categorized in levels (1 = easiest, 5 = hardest).
Users get shown two exercises and should decide which one is harder or if both are equal. Based on user ratings, the levels should get adjusted.
What I've done:
I experimented with the Elo rating.
My Questions:
Are there any better algorithms for doing this use case? (found nothing so far)
Thanks in advance and cheers.
Toby
I would try to solve the problem in a simple yet (I hope) effective way.
First, you only update an exercise rating when the vote is different that what the system actually expects. From now on, I will only considers the cases where the user output differs from what the system actually expects.
Second, I would give more weight to the votes where the two levels have a big difference. A wrong expectation on two esercises with rating 2 and 3 should have less impact than a wrong expectation on two exercises with rating 1 and 5.
That said, my algorithm would be along the lines of:
1- A constant percentage is set, let's call it increment. It establishes the percentage of impact that a vote has, and can be modified along the way based on the number of users.
2- For an "unexpected" vote, I would calculate the difference between the original levels (minimum of 1).
diff = max(1, abs(ex1.level - ex2.level))
3- I would update each exercise rating by a percentage, based on the multiplication of increment and diff.
if (ex1 level expected bigger)
ex1.rating = ex1.rating + diff*increment;
else
ex1.rating = ex1.rating - diff*increment;
Rating would be a float, and level would be the rounding of rating:
ex1.level = round(ex1.rating)
Example:
let's set increment = 0.1. exA, with a rating of 2.0 and level 2 is compared with exB, rating of 3.0 and level 3.
The first user selects exB as the hardest. Nothing changes, because it is the result expected by the system.
The second user selects exA. It is not the expected result. The difference between the two exercises is 1, so the rating is modified by a factor 1*0.1 = 0.1,
resulting in a exA.rating = 2.1 for exB.rating = 2.9

Tableau - Calculated fields / grouping / Custom Dim

Tableau:
This may seem simple, but I ran out of the usual tricks I've used in other systems.
I want a variance column. Essentially adding a member 'Variance' to the Act/Plan dimension which only contains the members 'Actual' and 'Plan'
I've come in where the data structure and reporting is set up like so:
Actual | Plan
Profit measure
measure 2
measure 3
etc
The goal is to have a Variance column (calculated and not part of the Actual/Plan dimension)
Actual | Plan | Variance
Profit measure
measure 2
measure 3
etc
There are solutions where it works for one measure only, and I've looked into that.
ie, create calculated field as such
Profit_Actual | Profit_Plan | Variance
You put this on the columns, and you get a grid that I want... except a grid with only 1 measure.
This does not work if I want to run several measures on rows. Essentially the solution above will only display the Profit measure, not Measure 1_Actual , Measure 2_Plan etc.
So I tried a trick where I grouped a the 3 calculated measures, ie Profit_Actual | Profit_Plan | Profit_Variance as 'Profit_Measure'
Created a parameter list - 'Actual', 'Plan', 'Variance'
Now I can half achieve my goal, by having the parameter on columns and the 'Profit Measure' on Rows (so I can have Measure 123_group etc down on rows too). Trouble is, I found that parameters are single select only. Only if it can display all options in the custom paramater at once, I would've solved my problem.
Any ideas on how I can achieve the Variance column I want?
Virtually adding a member to a dimension/Calculated fieds/tricks/workaround
Thank you
Any leads is appreciated
Gemmo
Okay. First thing, I had a really hard time trying to understand how your data is organized, try to be more clear (say how each entry in your database looks like, and not how a specific view in Tableau looks like).
But I think I got it. I guess you have a collection of entries, and each entry has a number of measure fields (profits and etc.) and an Act/Plan field, to identify whether that entry is an actual value or a planned value. Is that correct?
Well, if that's the case, I'm sorry to say you have to calculate a variance field for each dimension. Think about it, how your original dataset is structured. Do you think you can add a single field "Variance" to represent the variance of each measure? Well, you can, store the values in a string, and then collect it back using some string functions, but it's not very practical. The problem is that each entry have many measures, if it had only 1 measure, than 1 single variance field would suffice.
So, if you can re-organize your data, what would be an easier to work set (but with many more entries) is something with the fields: Measure, Value, Actual/Plan. The measure field would have a string to identify what you're measuring in that entry. Value would be a number to represent the actual measure. And the Actual/Plan is the same. For instance:
Measure Value Actual/Plan
Profit 100 Actual
So, each line in your current model would become n entries, where n is the number of measures you have right now. So a larger dataset in a way, but easier to work with. Think about, now you can have a calculated field, and use some table calculations to calculate the variance only for that measure and/or Actual/Plan. Just use WINDOW_VAR, and put Measure and/or Actual/Plan in the partition.
Table calculations are awesome, take a look at this to understand it better. http://onlinehelp.tableausoftware.com/current/pro/online/en-us/help.htm#calculations_tablecalculations_understanding_addressing.html
I generally like to have my data staged such that Actual is its own column and Plan is its own column in the data being fed to Tableau. It makes calculations so much easier.
If your data is such that there is a column called "Actual/Plan" and every row is populated with either "Actual" or "Plan" and there is another column called "Value" or "Measure" that is populated with the values, you can force Tableau to make them columns assuming you can't or won't rearrange your data.
Create a calculated field called "Actual" with the following calc:
IF [Actual/Plan] = 'Actual' THEN [Value] END
Similarly, create a calculated field called "Plan" with the following calc:
IF [Actual/Plan] = 'Plan' THEN [Value] END
Now, you can finally create your "Variance" and "Variance %" calculations (respectively):
SUM([Actual]) - SUM([Plan])
[Variance] / SUM([Plan])

Resources