Suppose I have some sample data like so:
and I create a Pivot Table and order by Product > Sales Rep > Sales
If I want the # of sales John had for Product1 I would do =GETPIVOTDATA("Sales",$A$3,"Product","Product1","Sales Rep","John")
But how would I get a count of the entries there are. i.e. for Product1, John had 4 and Kevin had 2
Is it possible to get this count using GETPIVOTDATA()?
To get this you need to add another Sales field to the values section and change the "Summarize By" to Count. Then the formula will =GETPIVOTDATA("Count of Sales",$A$3,"Product","Product1") will get you the count of Product Overall.
Related
I have a spreadsheet that contains data for customers that have purchased items from my store. What I would like to do is go back the last couple years, using a pivot table, and display: number of customers that ordered something each month (a count of unique customer names).
The sheet is organized as such:
Date | Invoice | Account Name | Item | Quantity | Amount
6/1/2020 | 50100 | John's Tire Shop | 1/2 Inch Socket | 2 | 12.00
Is there a way inside pivot table options to count unique account names and display the total grouped by month?
You can create a helper column to identify unique values per month to add as a filter to your pivot using your existing setup
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,"y","n")
I would propose you to add a helper column to your data, containing the =Month(A:A) function. But be careful: I see that your first date equals "6/1/2020", is that the first of June or is this Epiphany? :-)
I have hourly data about sales $ of certain categories (Fruits, snacks etc). I'd like to display the median of daily sales values over a month or an year using the hourly data in the table. So, for each category it needs to sum the hourly values and create a daily value first and then calculate the median
regular pivot does not provide median function. I am familiar with Power pivots but have not used Measures. i tried to create a measure using medianX function, but could not make it work
First, you will need to add a Calendar table to your data model:
Calendar Table Explained
The Calendar table must have fields you want to group your sales by, such as "Year-Month" and "Year-Quarter".
Then, connect the Calendar table to your Sales table via date fields, to get a structure like this:
With this data model in place, create 2 measures ( I will assume your sales table is called "Sales", and calendar table is called "Date"):
Measure 1:
Total Sale = SUM(Sales[Amount])
It will simply calculate sum of sale amounts.
Measure 2:
Median Monthly Sale = MEDIANX( VALUES(Date[Year-Month]), [Total Sale])
This measure will first sum up sales by Year-Month, and then calculate the median of the sums.
To get median sales by a different period, just replace Year-Month with the desired grouping level, for example:
Median Yearly Sale = MEDIANX( VALUES(Date[Year]), [Total Sale])
Ali,
When you create your measure you will want to use the MEDIAN funciton not MEDIANX
The MedianX would be if you were trying to calculate the median value for a column in your table that did not already exist.
For Example, lets say we have Table1 which has two columns Net Revenue and Net Expense. And the following 3 data points exist for each row in the column.
Net Revenue:
Jan-2019 100
Feb-2019 300
Mar-2019 300
Net Expense:
Jan-2019 50
Feb-2019 100
Mar-2019 50
Since we do not have a Net Profit column in the table we could use MEDIANX to specify the table we would like to use then write our expression for the column that doensn't exist. In the example above it would go =MEDIANX(Table1, [Net Revenue] - [Net Expense]. This would create a median measure for NetProfit even though the column itself doesn't exist in our table.
In your case, since you are aggregating a column that already exists you can just stick with =MEDIAN.
If you need more clarification let me know!
Best,
Brett
I have a data returning in a data set that looks like this:
Department 1 Product Name Units
Department 1 Product Name Units
Department 2 Product Name Units
Department 2 Product Name Units
Department 3 Product Name Units
Department 3 Product Name Units
I have added a Group Band that will group by Department and in the group footer band a summary that will sum units by Department.
I want to show a bar chart with the Department as the argument and the Units as the value. But all I get in the report is each record repeated in the chart, i.e. not grouped by Department. Do I need to define a relationship and use that as argument in the chart series?
You have to use the AutoSeries properties (under Series tab) in order to get your data grouped by something This way you would have a different serie for each different value you used on your Auto Series Key Data Column
I am trying to create a pivot table and pivot chart in excel 2016 based off of cattle auction data. Data for each auction includes: Head of Cattle, total weight, avg weight, price per lb, and price a head. I am trying to show the avg price per head of particular weights. The trouble is when one transaction is for 30 head # $800 and the next is for 1 # $700 it shows average price of $750. But I want to show the average weight of the 31 cattle at $796 not the average of the transactions # $750. Any ideas?
From what you've laid out in your question, it sounds like you should do some calculations in your data before you pivot it. Basically, make a new column that is [transaction] * [the head of cattle], so in this case the new column values are 24000 and 700, respectively.
From there, you can insert a pivot table and use a custom calculation. While in the pivot table click on 'Options' and then click on "Fields, Items, & Sets". Then set the calculation in the formula bar to your new field divided by head of cattle.
I have a table that has two category columns, a column for number started and a column for number finished. I'd like to roll up by one category column and calculate a percentage finished in a pivot table (rather than array formulae).
Imagine my data looks like this:
Date - School - Starters - Finishers
7/1 USC 100 25
7/1 UCLA 200 50
7/2 USC 250 100
7/2 UCLA 200 100
I want my pivot table to look like this
Date - Finish rate
7/1 25%
7/2 44%
But when I go into Value Field Settings to switch to a calculation, I can't figure how to get the column comparison to happen.
You can create a calculated field that compares two other fields in the "Pivottable Tools" "Analyze" ribbon "Fields, Items, & Sets" button - "Calculated Field". Just build comparison expression in the "Formula" text field of the "Insert Calculated Field" dialogue box.