Combining Column Values in an Excel Pivot Table - excel

In order to simplify a stacked bar chart, I am looking to sum up the counts of multiple columns I have in my pivot table. For example, in this sample table, I would like to combine Fruits and Vegetables into one column, so that each bar will comprised of three colors: one for Meats, one for Grains, and one for Fruits+Vegetables.
Pivot Table and Stacked Chart
For reference, this is the data source:
Data Source table
I tried adding a Calculated Field, but I'm not sure if I can use specific values from a column in the Formulas field. Is there a way to create something like this from a pivot table, or should I be taking a different approach to this all together?

I'm using Excel 2016, -- pretty sure it's the same with older versions, but the premise is the same.
In your pivot table, Select the Pivot Table Tools> Analyze tab, then "Fields, Items",then pull down to"Calculated fields". Enter a name for the generated field, and the formula you want to use:
In my example, I added the fields Fruit and Vegi's from my available pivot table fields (which is based on my data table).
Then select the calculated field as you would any other..
and create the chart as usual.
Hope this helps.

Related

Convert Excel table based on Column Values using VBA

Have this Table below ,
I would Like to use the Header Column to transform the Table like this
Any Help It will be great, Best regards
Hala
You can easily solve this puzzle with a pivot table. Put the amount field into the values section of the pivot and set to get sums. Put the header field into the columns section of the pivot. And put the rest fields into the rows section of the pivot. Pivot will auto-show the grandtotal and subtotals per rows but you can remove them easily with a right click on it. And finally to get a view like a data table click repeat all item labels in pivot's report layout.

Pivot Table sorting - category instead of "Values"

Below is the extract of a table i want to sort
I'd like to create two Pivot Table in two separate sheets so that I only have the start and end Dates corresponding to only one of the two categories, i.e AC156 or AC157
Extract of the result tables
Since the source list keeps getting updated, I'd really like to do this using Pivot Tables so that I can keep refreshing it.
It seems simple enough but I'm admittedly quite new to Pivot Tables. Any help would be appreciated.
Highlight your data table;
Insert a pivot table;
Put all three columns into Rows field;
Right click somewhere within the pivot table, go to PivotTable Options, go to Display, select Classic PivotTable layout (enables dragging of fields in the grid);
If your pivot table has grouped the dates by month, un-check Months2 in the data fields but leave Months if you want to sort by Start date;
If you pivot table has shown the subtotal for start date, right click the subtotal row and deselect Subtotal 'Start'.
You can make a copy of the pivot table, filter the Cat, sort the Months and then Start, then you should have:

Excel: Pivot Table Filtering Using VBA/Slicer?

Gold star for whoever solves this! :)
I have a pivot table that has data from various attributes attached to unique ID numbers from an OLAP cube report. When I select ID# as a pivot field and all the corresponding attributes ie: Name,age,etc I end up getting about 10k ID's with 10k corresponding attribute values. I have a list of 3k ID#'s which I want to filter my report by. What is the best way to do this?
Simple example: Pivot table displays ID# 1,2,3,4,5 and corresponding attributes such as name,age,etc
I want to filter ID#'s from a column of values I have in another worksheet for example the column in other worksheet would have ID#'s 1,2,3 (Which in theory would omit values 4 and 5 from pivot)
(Keep in mind I am dealing with thousands of rows this example is made simple just for explanation)
I thought a VBA slicer combo might work, but I have no clue how to set up a slicer so when it is created it has only values selected from a column of values.
In my example VBA slicer will have ID#'s 1,2,3 selected upon creation or an easy way to select multiple ID#s from a list or something as I can't feasibly click through 3k values
Possible Solutions I Brainstormed
I was also thinking maybe just a VLOOKUP or something that will pull ID#'s against the column and also bring all corresponding attributes? The thing is I like the cube report being dynamic and updating with the slicer.
I then also thought to create a slicer based off of another pivot table which is composed simply of a header of ID#'s and lists ID# 1,2,3 I created in another worksheet and try and use that simple slicer against the OLAP cube, but the issue is the slicers have different connections and they can't overlap. :(
Any and all help is much appreciated!!! :)

Extracting data from a Pivot table to a table with two columns. Combining two cells to one

I'm trying to extrat data from a pivot table. See photo below. Basically I need an end product with two columns, one with the date, the other listing all it's associated labels in one cell. (i.e. for "2015-06-14" it would list both 875-7A and 875-8 in one cell one column over). Please help.
EDIT:
New table. Now just to combine the data into one cell if the date has more than one label. the logic: =if("the date" has more than one value", plot value 1 & value 2 into once cell.)
Select the Pivot table
Go to the Ribbon: PivotTable Tools \ Design
Report Layout \ Show in Tabular form
This should do it. Look at the other options in Report Layout and Subtotals to test other layout options.

Excel Slicers for Measures

I have a cube with two measure(count of patients) and (distinct count of visits) , and various dimension(date,program,region,etc), when I browse the cube data from excel, I can choose all the dimensions in the slicer, but my question is is there anyway i can choose the measures in the slicer? From what I see, when I insert a slicer I only get to pick the dimesnions
Any help would be appreciated
I'm not sure of a way around using PowerPivot to do this, short of complicated VBA scripts.
To do it with PowerPivot:
Create a new table with two columns. Column 1 contains the name of your measures and column 2 contains an index for each. e.g.
and add this to the Data Model (but don't create any relationships to any other tables).
Create a new measure with a SWITCH function that has the same relationship between the measures and their values in the Index column, e.g.
[Chosen Measure]:=SWITCH(TRUE, MIN(MeasureTable[Index])=1, [DistinctPatients], MIN(MeasureTable[Index])=2,[DistinctDates])
Add the new measure to the values section of the pivot table and add the
Measure column from your new table to BOTH a slicer AND the column headings in the pivot table and remove the row and column totals.

Resources