Create a list of mode values based on table in Excel - excel

I am trying to create a table that will show me the mode of a data set. The data is contained in 3 columns.
Sample Data
Though the actual data set is thousands of rows
I am trying to identify what the most frequent rate paid is for each weight and zone.
I can get an average via a pivot table. I can also have a pivot table show me how many times each rate shows up in each weight and zone, but that is just a count. I would like it to show me the mode rate.
Any ideas on how to work this would be very appreciated!
Update: This is what I need the end result to look like:
Result:

I found the answer to what I needed to do here: https://www.get-digital-help.com/2010/02/11/match-two-criteria-and-return-multiple-rows-in-excel/
I was able to use this formula to create a list of values. From that list I used a mode and min formula to return the mode or min value.
From that I was able to populate a table with the values as needed.
Screen shot of the results.

Related

How to get automatically total amount of number I created from table at Excel?

I had to put the total amount of the object manually on top of the table as I couldn't find a way to get it automatically from the table of numbers I created. Could somebody kind-heartedly teach me how to do this automatically by simply pulling the data of the table created at Excel?
To add the total sum of each stack on top you have to use a Custom Combination Diagram and then add Data Labels and then adjust them via Format Data Labels.
If you need a pictured step-by-step explanation have a look here.

How to add multiple measures into a pivot table?

I'm quite new to using pivot tables and data models, so I don't even know if what I want to do is possible. I have a pivot table (PivotTable1) and its source (Table 25) and I would like to add a hundred or so measures which are listed in the TableCombinations.
For example, I entered the two first measure in orange, but they are not linked to TableCombination and entering them all one by one would be quite long. Each measure is for a distinct Sum wfn column that sums all other rows multiplied by a coefficient. The TableCombinations table simply states the coefficient to be used for each column. For the first three rows, these are my measure formulas :
sum wf1=1.4*Table25[Sum of wD]+0*Table25[Sum of wL]+0*Table25[Sum of wS]+0*Table25[Sum of wW]+0*Table25[Sum of wWSOUL]
sum wf2=1.25*Table25[Sum of wD]+1.5*Table25[Sum of wL]+1*Table25[Sum of wS]+0*Table25[Sum of wW]+0*Table25[Sum of wWSOUL]
sum wf3=1.25*Table25[Sum of wD]+1.5*Table25[Sum of wL]+0*Table25[Sum of wS]+0.4*Table25[Sum of wW]+0*Table25[Sum of wWSOUL]
...
Two questions :
Is there a way to link the tables so that any change made to TableCombination would then be updated in the pivot table measures?
Is there a way to generate all the of the measures without typing them in one by one.
You should be able to use just one DAX measure to do this, using the CROSSJOIN function.
Don't set up a relationship between the Tables, and drag # to the Columns area of the PivotTable. Then create this Measure:
=SUMx(CROSSJOIN(Table1,Table2),Table1[wD]*Table2[wD]+Table1[wL]*Table2[wL]+Table1[wS]*Table2[wS]+Table1[wW]*Table2[wW]+Table1[wWSOUL]*Table2[wWSOUL])
That should give you the exact answer you need.
Here's how it looks using some sample data:
...and here's the sample data I'm using:
You could certainly use VBA to add measures, and to update them when the Table changes. I might have a crack at writing up an answer along that approach shortly. But here's another way to achieve what you want.
I've previously written some code to slave a Table to a PivotTable, so that any change in the PivotTable's dimensions or placement will be reflected in the shadowing Table's dimensions and placement. This effectively gives us a way to add a calculated field to a PivotTable that can refer to something outside of that PivotTable. If the PivotTable grows, the Calculated Table will grow. If the PivotTable shrinks, the Calculated Table will shrink, and any redundant formulas in it will be deleted.
You can easily use this approach to perform your calculations in a 2nd table alongside your PivotTable, and each column x in that 2nd table could easily reference row x in your 'parameters' table.
See Select Newest Record and Create New Table of Unique Values in Excel

Pivot table with registers duplicate in 2 row

I have a question about how to summarize a list of data, I attached an image of how the data is presented.
The question is how to determine (summarize) the total of activities per unit considering that a person works in 2 units.
You could define that the person working in A / B does 50% of activities for each unit.
As the list of registers is very extensive the idea is to be able to automate, try with a PivotTable and did not give me result.
Any suggestions would be appreciated (xls, sql, etc).
data
http://ge.tt/381feDj2 -> Excel fILE
Am really not the best of people when it comes to Pivot Tables, but assuming i know what you are asking for.
1) Add one extra column (dummy) and just put 1 in it, this will be used to sum the number of events that the criteria occurs.
2) Select the whole table and then Insert=>Pivot Tables
3) Click Ok
4) Set Rows (fecha); Values (dummy); and the rest to Filters.
Then you can choose to filter your output the way you want. If you want A and A/B you can select multiple in the filter options.

Avoid DISTINCTCOUNT in PowerPivot

Due to performance issues I need to remove a few distinct counts on my DAX. However, I have a particular scenario and I can't figure out how to do it.
As example, let's say one or more restaurants can be hired at one or more feasts and prepare one or more menus (see data below).
I want a PowerPivot table that shows in how many feasts each restaurant was present (see table below). I achieved this by using distinctcount.
Why not precalculating this on Power Query? The real data I have is a bit more complex (more ID columns) and in order to be able to pivot the data I would have to calculate thousands of possible combinations.
I tried adding to my model a Feast dimensional table (on the example this would only be 1 column of 2 rows). I was hoping to use that relationship to be able to make a straight count, but I haven't been able to come up with the right DAX to do so.
You could use COUNTROWS() combined with VALUES().
Specifically, COUNTROWS() will give you the count of rows in a table. That means COUNTROWS is expecting a table is input. Here's the magic part: VALUES() will return a table as results, and the table it returns are the distinct values in the table/column that you provide as the argument for VALUES().
I'm not sure if I'm explaining it well, so for the sample data you provided, the measure would look like this (assuming the table is named Table1):
Unique Feasts:=COUNTROWS(VALUES('Table1'[Feast Id]))
You can then create a pivot table from Powerpivot, and drag Restaurant Id into Rows, and drag the measure above into Values. Same result as DISTINCTCOUNT, but with less performance overhead (I think).

Calculating the difference between the count of two date fields

I have data that is provided to me that includes the routed date and the service restoration date. From that it's pretty easy to generate a pivot table that generates a table with the date of the month, then a count of received tickets (routed), and the count of closed tickets. I'm trying to generate a calculated field (Pivot -> Options -> Fields, Items & Sets -> Calculated Field) to derive the delta.
When I use =Received - Closed, I get the difference in date rather than the delta in the counts. Can anyone point me in a direction on how I may calculate it? If it was static content it would be easy peasy, but I'm not getting the knack of doing this with a pivot table. Also I could achieve something similar with a countif type command and run it from a static calendar type table (which is what I'll probably end up doing if this ends up being a dead end).
As a solution, you can copy the pivot table and paste it as values in the new sheet. Do you math on values instead of on pivot.
I don't know if formatting your results in the pivot as NUMBER would help.. But you can try that as well.
I was unable to determine a way outside of what was mentioned above by Andrew. I've set up a static date list for the calendar month and then use a series of countifs instead of a pivot table to generate the output. Thanks to all who reviewed the question and to Andrew for his responses.

Resources