Excel PivotTable create column based on summarised column data - excel

I have the following Pivot Table:
I am trying to derive the number of cases created per resource for a given month. I.e. for Jan 2021 the formula would be 768/9 = 85.333...
I've tried to use a Calculated Field, but the issue I'm having is that the PivotTable uses the underlying data e.g. for a given case, create date is 1/1/2022 and the resources on that day is 8. It is then dividing the numeric value of 1/1/22 by 8 and coming up with a value in the thousands, for obvious reasons, and then working out the average/sum/etc for all of the cases within that month. What I need is a way of just doing B5/C5 but within the pivot table itself, rather than a column outside of the pivottable. Is this possible?
P.S. Sorry if this is a basic one that has already been answered, but I'm not always sure on the correct terminology for PivotTable functionality so I've likely been googling like a 6 year old.
Thanks,

Related

In Tableau can I calculate a column based on totals of two other columns?

I'm new to Tableau and new to posting in Stackoverflow so bear with me.
I have a dataset with variables such as State, County, Organization, 2020 Enrollment, 2021 Enrollment, and Delta (change in enrollment over those two years). What I want is a column that gives the percent delta in enrollment over these two years.
The first thing I tried was calculating a column just using the growth formula:
(ZN([2021Enrolled])-ZN([2020Enrolled]))/ZN([2020Enrolled])
In the Data View this works great, because nothing is being summed, I get the correct delta. But when I use this formula in my worksheet, what happens is that the formula is being calculated across all the observations (there are several observations per county, per organization, for example) and then summed up. This gives an incorrect delta for year over year.
What I am looking for is a way to calculate the % delta column based on the total enrollments for 2020 and 2021 in order to achieve the correct % delta.
I included two screenshots below showing what Tableau is giving, and then an Excel spreadsheet of the same data filtered on just one county to show the problem a little better.
Maybe a similar question has been asked before, but I was unsure just how to search this up. Any help would be appreciated.
Thanks!
Sam
Tableau view
Excel view
I found the answer: I was trying to create a calculated column in Data View, what I needed to do was create a calculated column in my worksheet view, so that it would only work on the data presented there.

Excel - A row in my Pivot table calculates sum wrongly only for some entries (same data type/format)

I created a tracker of learning hours in order to conduct an experiment.
For the purpose of the ticket, there is a time series that does not sum correctly data in Pivot table.
Some other tickets on Stack Overflow mention how to correctly sum. Here's what I tried:
considered blank spaces > the Pivot does not consider them anymore, yet the issue persist.
data type & format > the whole column is set for data type short date
labeling > I use to copy-paste the category for each learning and I double checked if there was no typo in them.
Here's how the file works. There are 3 sheet in my Excel file. The core of it is "Data" where I do track the time spent for each learning / exercise. The columns marked in red are the ones used for the next Pivot Table.
These information are consolidated in another sheet, called SuperLearner Review. I use this one to display overall learning hours by type and category. Numeric outputs here are looked up from Data (or calculated accordingly).
After several checks, I cannot retrieve the issue. All I know is that for February data are not tracked correctly.
Originally I attributed either to wrong data labeling or format, but I can manually see what is the real sum of learning done in February:
In the data-series those hours seem not to display. This is what the Pivot table returns instead:
Whereas, for the consolidated information (coming from the same source) does not seem there are problems in calculation:
When I tried to cancel and build up again the same Pivot Table, the same error occur. So I am not getting out of this wrong calculation. Therefore it must not be a problem of calculation, rather than Excel does not retrieve some data entries at one point.
What would you recommend? Thanks for the help.

Calculate average based on a value column (count) in a pivot table

I'm looking a way to add an extra column in a pivot table that that averages the sum of the count for the months ("Count of records" column) within a time period that is selected (currently 2016 - one month, 2017 - full year, 2018 - 5 month). Every month would have the same number based on the year average, needs to be dynamically changing when selecting different period: full year or for example 4 months. I need the column within the pivot table, so it could be used for a future pivot chart.
I can't simply use average as all my records appear only once and I use Count to aggregate those numbers ("Count of records" column).
My current data looks like this:
The final result should look like this:
I assume that it somehow can be done with the help of "calculated filed" option but I couldn't make it work now.
Greatly appreciate any help!
Using the DataModel (built in to Excel 2013 and later) you can write really cool formulas inside PivotTables called Measures that can do this kind of thing. Take the example below:
As you can see, the Cust Count & Average field gives a count of transactions by month but also gives the average of those monthly readings for the subtotal lines (i.e. the 2017 Total and 2018 Total lines) using the below DAX formula:
=AVERAGEX(SUMMARIZE(Table1,[Customer (Month)],"x",COUNTA(Table1[Customer])),[x])
That just says "Summarize this table by count of the customer field by month, call the resulting summarization field 'x', and then give me the average of that field x".
Because DAX measures are executed within the context of the PivotTable, you get the count that you want for months, and you get the average that you want for the yearly subtotals.
Hard to explain, but demonstrates that DAX can certainly do this for you.
See my answer at the following link for an example of how to add data to the DataModel and how to subsequently write measures:
Using the Excel SMALL function with filtering criteria AND ignoring zeros
I also recommend grabbing yourself a book called Supercharge Excel when you learn to write DAX by Matt Allington, and perhaps even taking his awesome online course, because it covers this kind of thing very well, and will save you significant head-scratching compared to going it alone.

Pivot Table - Calculating averages and using two filters not at the same time

I am trying to create two different Pivot Tables.
The first table will have columns including investor name, initial date of investment, # years as investor, initial investment value, change in investment value. I would then like to Filter the data either by what I call the "Fund" OR "Channel". So I would like to be able to calculate the average change in investment value and average initial investment value and average number of years as investor while using either of my filters. IE I will have the average number of years as investor only within a certain "Fund" or "Channel". I am not sure how I can create these averages.
The second table is similar, but I need help with both the table and formatting the raw data. What I would like is to be able to take any instance of an Investor and use their first investment value by date as the initial value column, then use the total of all the instances' present values as the Present Value column, in order to calculate the change in initial value to present value for ALL instances. I would then like to make a Pivot table using this information in the same way as my first question.
This is hard to explain so please ask if I am not being clear.
Great question. I'm curious to read some answers from the experts.

Creating a sum based on a category within a date range

I'm trying to make a spreadsheet that I can easily take an export from Mint.com's CSV outputs and get them into my Excel budget.
To do so, I need a way to populate each field within a date range. I'd like to avoid macros if possible (I don't know how to make them).
I'm happy to share my finished .xls with the public!
I've imported Mint.com's data in a manner that has column S for the date (3/30), column V with the cash value that I need to add up, and column X for the spending category.
I need to tally each month's spending ($V) by category (column X).
Through research, I devised this (for my January "Gas & Fuel" spending):
=SUMIFS($W$2:$W$900, $T$2:$T$900, ">="&W$12, $T$2:$T$900, "<"&(EOMONTH(D$1,0)+1), $Y$2:$Y$900, "="&$B5)
However, it required that I reformat my Dates, which is an issue because this would become specific to each year and I would need to change the fields every year. I'd like the document to be usable without adjustment using my spending data from the past and future.
Is there a way to take the year out of the equation? To make that formula above work, I renamed my column from "January" to "1/14".
Here is what the spreadsheet looks like
Thanks!
A pivot table would work best with that data.
Initial set up would show each day separately, but by using Grouping
(here) ^^^
you can group the data by month/day/year/however

Resources