I have a data I want to sort into pivot-based graphs and I need help with it.
Below is an example of the data im sorting
Basically, I want the pivot to have a week number and category filter. Then for it to sort the data like a frequency based line-chart based on how many people have unit output in certain ranges. End product should look like this.
I am having trboule because every category has very different min and max points so it can't be done manually.
I tried to use a traditional pivot table but I cant get the frequency part down.
Thank you
I'm trying to create a column in a pivot table I've created that calculates the difference between a forecast and actual cost column. Under 'Fields, Items, & Sets', 'calculated field' is grayed out/unavailable. From other forum posts as far back as 2010 (all with dead links to websites meant to explain it more), I've heard that this has something to do with using data that comes from an OLAP table.
My 'actual cost' data is being pulled from a server and funneled into a group of tables on separate sheets. I also have a manual entry sheet for the forecasts (also type table) that's being connected to it. that I'm The cell count is in the millions and steadily increasing, so it's understandable that the system uses OLAP to refresh manually (it takes about a minute to 'refresh all'). That said, I don't know why this would prevent me from doing math with these columns. I've looked up some videos on OLAP and I figure it's just above my head. I've looked into converting it into a "dynamic range" per a recommendation from about 10 years ago, but there isn't much about what that actually is online and I'm not sure I'd be able to do that with how I'm pulling it from the database. That, and I'm doing about 2 weeks worth of operations that are probably dependent on it being a table. I'm not even sure if you can feed data into power pivot if it's not a table.
I have a way that I think I can do this, but it requires about a week's worth of work manually building out a massive, un-iterative sheet. It would pull all of the values for a specific job of each activity type, sum them, and then compile them into another table that can be used to find the difference between the values of forecast and actual. But, at that point I'm basically just making a worse pivot table infrastructure from scratch.
Is there a way that I can just side-step this issue? I've only been using power pivot for a few weeks and this is the first time I've had to do math between columns, so it may be that I'm missing something that most people know.
Is there a way to let a pivot table calculate the difference between 2 columns automatically when the values are shown as a % of the parent column total?
Now I need to to manually but the table is dynamic and number of competitors may vary. Function seems so easy but can't find it after googling etc...
See example picture below of what I want to achieve.
(Column F automated by the pivot table is the goal)
If trying to solve this with PivotTables, you've got a couple of options:
Use a 'Traditional' PivotTable that's based on a range. This will give you percentage differences, but you can't get percentage point differences like you're asking for without using external formulas.
Use a 'OLAP' PivotTable that's based on data you've added to the Excel Data Model. This will give you both percentage differences and percentage point differences, without having to resort to using external formulas.
In both cases, I recommend that you unpivot your data first, so that it is in what's known as a Flat File. Currently you're using a cross-tabulated data source (i.e. your source has columns called Year 1, Year 2), and the type of percentage comparisons across years you want to do doesn't work if your data is a crosstab. Basically, PivotTables aren't meant to consume cross-tabulated data.
Instead, you really want your data laid out so that you have a column called Amount and a column called Year, and then you can use the Show Values As options available from the right-click menu to show as percentage differences across years. To transform your data into a flat file, see my answers at convert cross table to list to make pivot table
That said, you can still use the GETPIVOTDATA function on your existing (unpivoted) data layout in a way that is somewhat more robust to changes in your PivotTable structure than just subtracting one reference from the other:
But again, I recommend transforming your data into a Flat File. Then you can additionally do the following:
Using a 'Traditional' PivotTable:
You can kinda solve your problem entirely within a self contained 'Traditional' PivotTable if you drag the Amount column to the Values area, put the Year column in the Columns area, put your Competitors in the Rows area, and choose one of the percentage Show Values As options you'll see when you right-click a cell in the Values area.
I say kinda, because without using external formulas (or without calculating the percentages back in your source data), you can only get it to show percent increases (see far right column), not percentage point increase like you want (see far left column). That said, I think percent increase is less confusing. But I guess it depends on what you want to show. If you want to show say change in market share from one year to the next, then percentage points make sense.
Of course, you could always use the GETPIVOTDATA function to do the additional math for you like we did earlier, like I've done on that left hand side.
Using an OLAP PivotTable based on the DataModel
Calculating percentage point increases likely requires using PivotTables built using the Data Model. See my answer at https://stackoverflow.com/a/49973465/2507160 that explains a little about the Data Model (although it doesn't answer this specific question).
Here's the result:
Here's the measures I used to do this:
Total Year 1:
=CALCULATE(SUM(Table2[Value]),ALLSELECTED(Table2[Competitor]),Table2[Year] = "Year 1")
Total Year 2:
=CALCULATE(SUM(Table2[Value]),ALLSELECTED(Table2[Competitor]),Table2[Year] = "Year 2")
% Year 1:
=CALCULATE(SUM(Table2[Value]),Table2[Year] = "Year 1")/[Total Year 1]
% Year 2:
=CALCULATE(SUM(Table2[Value]),Table2[Year] = "Year 2")/[Total Year 2]
p.p. Diff:
= [% Year 2] -[% Year 1]
You can add Calculated Fields to Pivot Tables, of varying levels of complexity. Finding the difference between two fields is about as simple as it gets.
The example below is borrowed from contextures.com, where there are many more examples more further information.
To add a calculated field:
Select a cell in the pivot table, and on the Excel Ribbon, under the PivotTable Tools tab, click the Options tab (Analyze tab in
Excel 2013).
In the Calculations group, click Fields, Items, & Sets, and then click Calculated Field.
Type a name for the calculated field, for example, RepBonus.
In the Formula box, type =Total * 3%
Click Add to save the calculated field, and click Close.
The RepBonus field appears in the Values area of the pivot table, and in the field list in the PivotTable Field List.
(Source)
EDIT:
#jeffreyweir - I'm not gonna lie, I don't know off the top of my head how to make this work (and don't have time to experiment) but by the looks of these options, isn't a calculated field with a "straight subtraction" of existing fields (ie., 3$-2%=1%) very possible with Difference from? (as opposed to % Difference from which is also an option but for a different result).
In fact, automatic year-over-year difference reporting should be readily possible with the <previous> and <next> comparison operators...?
(Click to Embiggen)
Also, did you see the link where I got the example? Kind of a hoakey site but it has some more complex pivot table instructions.
I'm trying to calculate the average age for different Groups. See Attached Picture. I have two related tables, and the result of the lower right pivot should match the pivot to its left. I'm fairly New to Power pivot and DAX-formula and I just can't seem to find a solution. Anyone?
Example
I think what you might be missing is the RELATED function. Try something like this:
test = AVERAGEX(Table2, RELATED(Table1[Age]))
I am having issues translating the following formula to a pivot table; either through a regular pivot table, or through DAX and powerpivot.
=SUMPRODUCT((C$2:C$11)*(D$2:D$11)*(A$2:A$11=A2)*(B$2:B$11=B2))/SUMIFS(D$2:D$11,A$2:A$11,A2,B$2:B$11,B2)
The background is, I have a number of products that appear on an e-commerce site, and I need to find out their price per day. However, these prices change daily, based on things like promo codes, visitor location etc. Therefore, I need their weighted price based on the number of visitors that saw a particular price.
Can anyone help with this translation, or alternatively, offer a better way to approach this problem?
PS- I need it in a pivot table due to the volume of data. At 250,000 rows, standard Excel cannot handle this formula.
The following is in Excel 2010 sans Powerpivot. However, the general approach should work:
Explanation:
I added a column that multiplies the Prices and Visits. The pivot table uses Dates, then Product SKU as the row labels. Then I added a calculated field that divides the Price*Visits by the Visits.