Assistance needed pivot table, Countif, Averages, and tons of data - excel

I have a pivot table with employees names, their grand totals of cases worked for the month, the days they worked during the month, and the case counts for each day.
I have them all stacked on top of each other on a sheet for fast viewing.
I created a column to countif Column (A) has a partial text value that matches the month.
In that column (AR) it returns 1 for true and 0 for not true.
I'm trying to create a formula where it sums up the 1s between the 0s.
The picture is horrible due to the size limits.
Basically, I need to count the days the employee worked and find the average case count for the month for each employee.
I can't use the average function in the pivot table because the count is based on IDs.
I tried If statements, and SumIfs.
ATTACHED IS A SAMPLE OF THE FILE I'M WORKING WITH
Picture of the Spreadsheet as requested

Sorry, i'm working on Excel in french. But I hope my answer with the file modified will help u understand what I'm talking about.
Here is your Excel sample with my modifications : Your Excel file that I modified
You can create another pivot table, that uses your previous pivot table as new datasource. But before doing that, make sure the elements of your first column "Claimed by" is repeated, by checking the column option "repeat element labels" like this :
In this new crosstab, you add as columns : the sum of "Case Count" ; and the count of "Days".
After that, you can filter the column "Claimed by" by selecting only elements without the word "total".
Then your average will be obtained simply by dividing the two columns.

Related

How do I create a custom grand total or calculated field in my pivot table in Excel?

I have a pivot table with various calculated fields. I want one of these calculated fields to change depending on what I choose from the slicer. In order to help understand what I'm trying to do I can provide some screenshots:
Here each row contains information for one SITA and each column is a calculated field. The Var(%) column is (ABS(OTB Occupancy - OFF Occupancy))/OTB Occupancy. The very last entry in Var(%) is calculated manually and takes the average of the column (this restricts me from filtering the pivot table as I'll have to recalculate the formula and/or move it to another cell so it stays in the position where it is the last cell).
Now my problem is I am no longer using this pivot table but I am starting to create other pivot tables which need to be more dynamic than this one. For example:
As you can see the first two entries of April in the pivot table correspond with the previous pivot table (OTB Occupancy and OFF Occupancy are the same as Sum of Act_Occ and Sum of Fct_Occ respectively). However, I need the third column to be the average given in the last entry of Var(%). (Please note that this cell isn't part of the pivot table and it's just a formula i used). But also, if I were to select two SITAs only from the slicer I'll want only the average of them two.
I'm not sure if excel can do what I want but any help is appreciated.

Need light formula to get some counts in large data sheet

I have an employee data base that contains names and 8 movement types (Ex. Recruitment, Resignation....etc). Also I have starting head counts.
What I need to do is calculating movement counts and head counts based on the month for 12 months. Currently i am using SUMIF formula to calculate all these and the thing is excel will be very slow with all formulas. Appreciate if anyone can help me on this. See the image below for sample of the formula and I need to insert this formula in more than 600 lines.
A pivot table would be a good way to go, but by the look of your criteria you'll need to create 'helper columns' to ensure your data is ready for aggregation in a Pivot table.
For instance in your master data tab, add a new column called 'MatchesCriteria' or words to that effect, and build a formula in that column that checks for all of the criteria that you want to have the report based on, and returns a 1 or a 0, e.g.
=IF( (IF(C2="Recruitment",1,0)+IF(D2="Secondment In",1,0)) > 0 , 1 , 0)
Then run a pivot table including the 'Plant' column in your Rows, the month column in your columns and the 'MatchesCriteria' in your data values, and switch the calculation type to 'SUM' rather than 'COUNT'.
This will do the trick and will refresh in a flash compared to evaluating all of those countif statements.

Distinct Count by Date in PowerPivot Column

I have a client I am importing lots of data from but to narrow it down it pulls in to powerpivot with a date column and a product column. They want to see a summary of how many days there was one item sold ("Solo Sale") two ("Double Sale") three, and four or more.
I am running into trouble due to the fact that they want to summarize the rest of their data by whether the day was a "Solo Sale" or "Double Sale" etc etc. Let's call this this the "Sale Count"
Because I need these "Sale Count" values on the rows of a Pivot Table, I'm trying to build a calculated column in the table that does a distinct count of the products by date but can't quite seem to get there using CALCULATE and/or FILTER. It always seems to give me a total distinct count of the products in the entire table rather than counting by each date.
Any advice on the DAX formula I should be using would be greatly appreciated. New to Power Pivot and I think I'm still thinking a little too excel-centric given there is very little row-logic in Power Pivot.
Thanks in advance!
Edited: Here is the table
PowerPivot Table
I would like the values in the SalesCount column to read 4 for every row with a date 1/1/2016, 1 for 1/2/2016, 2 for 1/3/2016, and 2 for 1/4/2016 (equivalent to the DISTINCTCOUNT of the Products on each day).
Then I would like to use conditional IF statements to replace those numbers with "Solo Sale" "Double Sale" etc so that I can use these values on the rows of a Pivot Table.
Try this as your calculated column:
=CALCULATE(
DISTINCTCOUNT(Table1[Product]),
ALLEXCEPT(Table1, Table1[Date])
)

Getting average of data with multiple entries for a single date using pivot table in Excel

I have tried this, but I am unsuccessful. I have the data dump in an excel sheet (Excel 2010). The first column has month. The second has the dates. The third column has numerical data. I have applied filters on each column to get the data on the Pivot Table. There are entries for each date. There are sometimes multiple entries for a single date. Now, when I run the Pivot, I get the proper sum, but when I select average, the average is accurate only for the single entries associated with a date. I need to calculate average of multiple data entries for a single date. Here is an example:
November 11/1/13 30
November 11/2/13 25
November 11/3/13 20
November 11/3/13 25
Now, when I run the Pivot table and select to average the data, it calculates the average as (30+25+20+25)/4 = 20 (since there are 4 entries, so the sum gets divided by 4).
This is not desirable.
I require the calculation to be made as taking the 3rd and 4th entry as one for the date 11/3/13. So, the required output is (30+25+(20+25))/3 = 33.33.
I hope the example gives an clear idea of the requirement. I need a solution for this. How do we modify the Pivot so that the average is calculated not based on just the number of entries, but the average is calculated for the number of days.
Create the pivot table described by Ron (with Sum only, not Average), then copy & paste special (values) this pivot table, then pivot that for averages.
Put your dates in the "Row Labels" area. It will Sum and Average by Date
Edit: To get the average of the sum of the daily values, you can either enter an Average formula someplace for the Pivot Table Sum Column, or you could use the following array-entered formula:
=SUM(Values)/SUM(1/COUNTIF(Dates,Dates))
Where Dates is the range where you have your list of Dates (on the original data sheet) and Values is the range where you have your original list of Values.
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
while hitting . If you did this
correctly, Excel will place braces {...} around the formula.
SUM(1/COUNTIF(Dates,Dates)) will return a count of the Unique dates, so it will return 3 for the dates in question in your example.
This proposed solution uses a working column named: Value (U)
Assuming that your data is located at [B4:B8].
Add a working column at [E4:E8]
Enter this formula at [E5:E8]:
= IF( COUNTIF($C$5:$C5,$C5) > 1, 0,
SUMIF($C$5:$C$8,$C5,$D$5:$D$8) )
Then use the working column Value (U) to sum and average the values, also add Value (U) as Page Field to filter out the Value (U)=0.

Use formula in custom calculated field in Pivot Table

In Excel Pivot table report there is possibility for user intervention by inserting "Calculated Field" so that user can further manipulate the report. This seems like best approach compared to using formula on Pivot table data, outside the Pivot table, for many obvious reasons.
"Calculated Field" dialog, looks like this:
and while it's easy to do calculation between available variables (as shown in screenshot) I can't find how to reference range of values for any of available variables.
For example, if for some reason I want to center the data in range A1:A100 I'd use = A1 - AVERAGE(A1:A100) and fill all rows in regular Excel table. But for Pivot table, if I use "Calculated Field" dialog and add new variable with formula: = 'Actual Sales' - AVERAGE('Actual Sales') I get 0 as output.
So my question is how can I reference whole range for 'Actual Sales' variable in "Calculated Field" dialog, so that AVERAGE() will return the average of all targeted cells ?
I'll post this comment as answer, as I'm confident enough that what I asked is not possible.
I) Couple of similar questions trying to do the same, without success:
Pivot Calculated formula: SUM(Field1)/AVG(Field2)
Excel Pivot Table Calculated Field
II) This article: Excel Pivot Table Calculated Field for example lists many restrictions of Calculated Field:
For calculated fields, the individual amounts in the other fields are summed, and then the calculation is performed on the total amount.
Calculated field formulas cannot refer to the pivot table totals or subtotals
Calculated field formulas cannot refer to worksheet cells by address or by name.
Sum is the only function available for a calculated field.
Calculated fields are not available in an OLAP-based pivot table.
III) There is tiny limited possibility to use AVERAGE() and similar function for a range of cells, but that applies only if Pivot table doesn't have grouped cells, which allows listing the cells as items in new group (right to "Fileds" listbox in above screenshot) and then user can calculate AVERAGE(), referencing explicitly every item (cell), from Items listbox, as argument. Maybe it's better explained here: Calculate values in a PivotTable report
For my Pivot table it wasn't applicable because my range wasn't small enough, this option to be sane choice.
Some of it is possible, specifically accessing subtotals:
"In Excel 2010+, you can right-click on the values and select Show Values As –> % of Parent Row Total." (or % of Parent Column Total)
And make sure the field in question is a number field that can be summed, it does not work for text fields for which only count is normally informative.
Source: http://datapigtechnologies.com/blog/index.php/excel-2010-pivottable-subtotals/
Thank you for planting a seed, Cel! I've been struggling with this for hours, finally got it. I was counting a text field, oops, calculation failed.
Created 2 helper columns in my raw data, each resulting in 1 if condition met, 0 if not. Then pulled each into a pivot column, mine are called, "Inbd" (for Inbound), "Back", where "Back" is a return to sending facility, so in reality the total is one trip, not 2 trips, i.e., back is a subset of inbound and not every inbd has a back (obviously). Trying to calculate in the pivot table so I can sort on the field the rate of back to inbound for each sending facility.
For my calculated field I used: =IFERROR(IF(Pvt_Back>0,Pvt_Back/Pvt_Inbd,0),0)
So: if we sent back to sending some number of times greater than 0, divide Back/Inbd to give me a rate; if equal to 0, then 0; if Inbd = 0, then 0 to avoid Div/0 error.
Thanks again!! :)
Pivot table Excel2007- average to exclude zeros
=sum(XX:XX)/count if(XX:XX, ">0")
Invoice USD
Qty Rate(count) Value (sum)
300 0.000 000.000
1000 0.385 385.000
Average Rate Count should Exclude 0.000 rate

Resources