I have Pivot table with one Axis field (containing 13 elements 0-12) and two Values series. One of the series (A) has 13 values. The other series (B) has only 3 elements.
When I make a pivot table, I'm able to hide the zero values using this explanation :
Excel 2010: Hide 0 values in Pivot
However when I make a pivot chart (line chart) the series B keep showing zero (or a line dropping to the x-axis). I want the line of the series B to stop when there are no values (the line should be floating on the chart).
Anyone has an idea how to achieve this ?
I faced a similar issue where the Series drops down to Zero.
I have a Pivot Chart linked to a Pivot Table with multiple Series for 7 different Key Figures & other Fields. I pick up my source data from BEx/BI using Formula to bring in some extra Columns & apply some miscellaneous formatting. This data is then forms the basis for my Pivot Table & Pivot Chart.
I found that you cannot filter the Pivot Table as the Fields do not contain items. You cannot use NA() or even "" (double-quotes) using Formula - this is because when using different kinds of aggregation within the Pivot Table the NA() cannot be SUMMED and hence the Series is not displayed. It also appears that setting a Cell to blank using "" (double-quotes) in a Formula has no effect either. I even tried #DIV/0! errors & then hiding the errors - no luck.
As a workaround, the "only" way I have found so far that works is to manually Filter my final data input for the Pivot Table by zero and then simply delete the values. Refreshing the Pivot Table then allows the Pivot Chart to hide the blanks and the data points will not be displayed. This means that any Series with intermittent values are displayed correctly.
Found a trick: in the data field use =if(x=0,na(),x/y). The graph will be fine but the table will look ugly (with #NAs). You can use conditional formatting on the table to set the font color as white when there is an error.
Voila!!!
Related
I need help in creating a Pivot chart. I have dates as a timeline and 4 categories but the values are difference between those 4 categories with points and without points.
I want a pivot chart with 4 categories as a column on each month and out of those 4 column it is stack with the value of categories without and with points
I tried creating it on pivot chart combo but it won't work and also trying to overlap two pivot chart but its ugly
The output in mind is something like this. A stack column within stack pivot chart. So example below is a column chart I need to change the value representation on each column chart that it has stack of those 4 categories with and without points
Pivot charts are very limited compared to the charting techniques that can be used in regular charts. You can build a regular chart based on the data that the pivot table returns. If the number of rows of the pivot table varies, you can use dynamic range names with formulas that capture the pivot table columns and use these for the chart.
What you describe looks very much like a stacked clustered column chart, which is not a standard chart, but can be created with a few tricks. Jon Peltier has a tutorial here for a result that looks like this:
Such a stacked bar chart out of a pivot table can be created with https://www.koia.io.
The source code is on https://github.com/centeractive/koia
Koia protects your data privacy - you do NOT need to upload your data but it ALWAYS stays local on your machine.
In koia, you can create pivots with just a couple of mouseclicks:
Choose the data that you want to work with
Go to the pivot table tab in the header
Drag&drop your columns/row values as you want them to be displayed in your pivot table
Choose the “stacked bar chart” option in the upper right corner (see picture)
Koia will automatically create the stacked bar chart.
The drag&drop options allow you to play around with your data (timeline and different categories) and see the changes in real-time
I have an Excel Power Pivot Data Model with one table of about 3m entries. In one of my sheets I have multiple slicers that I combine to select entries that fit specific criteria.
I would like to add a column with a value that comes from a cell in the sheet, but only when the entry was part of the selection. For example: when the value in the cell is 1, the selected entries will get "1" in the added column. After that the number in the cell could be set to 2 and a new selection could be made. The new selection will all have "2" in the same added column.
I have been trying to make this work running a macro and DAX, but it can't get it to work. Anyone any ideas?
You can use the VBA I've previously posted at Converting multiple variables into values with excel pivot tables or power pivot to do that. It requires you to make up a 'harvester' PivotTable containing just the columns you want to swap out, so that you can then create a slicer from which to trigger the code.
You can also write a conditional formula in DAX that uses a harvester measure. Something like https://powerpivotpro.com/2012/11/one-slicer-to-control-them-all/ (and plenty of other examples on Google)
I am facing an issue with excel offset function for a range which increases horizontally and vertically.
I have a pivot table built from raw data which keeps on updating. I am mainly concerned with products and corresponding price per quarter in the pivot.
I have created another sheet pulling the products from the pivot and corresponding blended price (calculated based on pivot values - Sales/Units).
Below is the code:
Formula to pull the products from the pivot:
IFERROR(INDEX($A$10:$A$155, AGGREGATE(15,3,ROW($A$10:$A$155)-ROW($A$9)/($A$10:$A$155<>""),ROWS($A$10:A10))),#N/A)
Formula to display the corresponding blended price for the product:
IFERROR(INDEX(AZ$10:AZ$155, MATCH($CC10,$A$10:$A$155,0)),#N/A)
Now I need to create a line chart for the above data. Below is the code for Name Manager:
Quarters=OFFSET('Blended Price Calculation'!$CD$9,0,0,1,COUNTA('Blended Price Calculation'!$CC$9:$DA$9)-1)
0.45_Saline=OFFSET('Blended Price Calculation'!$CD$10,0,0,1,COUNTA('Blended Price Calculation'!$CC$10:$DA$10)-1)
0.9_Saline=OFFSET('Blended Price Calculation'!$CD$11,0,0,1,COUNTA('Blended Price Calculation'!$CC$11:$DA$11)-1)
10_Dextrose=OFFSET('Blended Price Calculation'!$CD$12,0,0,1,COUNTA('Blended Price Calculation'!$CC$12:$DA$12)-1)
Similarly for the rest of the products
I want to the horizontal axis to be Quarters and not Products.
Dashboard - Filter based on Slicer
Original Excel without filter
Excel when Slicer filter is applied (to display only 2 products)
Problem:
The chart displays #N/A when I filter data using Slicer in the dashboard. Slicer is acting on pivot table. Basically I need help on offset function which will pick only those values which has data for both rows and columns. Currently I have the formula working for Columns but it is not working for rows, hence the line chart is considering all the rows. But since I have selected only a couple of products (using slicer) out of 100 odd products, line chart shows graph perfectly for those selected products and shows #N/A for the rest.
How can I not display #N/A in my chart legend? I think having a combination of vertical and horizontal offset function should solve my problem but I am struggling to find the solution.
Any help is really appreciated! Thank you!
The issue here is that you have hard-wired ten series into the chart. You can use range names to dynamically change the number of data points in a series, but you can't use a formula approach to dynamically change the number of series in a regular Excel chart. That will require VBA.
If you use a pivot chart instead, you can select the series with a slicer and the legend will show only the visible series.
Edit: Here is a screenshot to illustrate how a pivot chart can be filtered and unused series will not show in the legend.
When creating values in a cell by using a formula: =IF(A2 = "RD", "RD", ""). Which says show value RD if RD and blank if not. I have three columns with different values, all set up the same way. When I try to pivot chart it, the data comes in but the count is not correct. All bars in the bar chart are exactly the same count even though the columns are filtered based on count of values (e.g., IF value is RD, count is based on RD and blanks not included). There are 37 RD values in column1, column 2 has 54 "RJ" values but bars in the chart reflect the same number which is the number of rows/cells in the table for each column. If I create the exact same chart using no formulas and use the pivot chart function, it works fine.
The issue here seems to be that pivot tables do not automatically update in some specific circumstances. That's more to do with how Excel actually flags cells for calculation updates.
SHORT ANSWER. You need to get the pivot table to refresh. Shortcut for that is click the sheet with the pivot table that isn't updating, then go to "Data" and "Refresh All". Or faster, hit keys Alt, a, r, a. (sequentially, not simultaneously)
LONG ANSWER. Do some research on dependency trees in Excel. Understanding dependency trees will explain how Excel marks cells for updates and it will allow you to make much more efficient workbooks.
I have an Excel spreadsheet which contains four data tables on the same tab. The final 3 columns in each contain formulae.
I then have a vba code which performs an sql look up within an SQL Server table and returns a set number of columns to update each of the four tables.
For three of these tables, the data is pasted in and the table automatically expands and the formulae is copied to the end of the table.
However, for the first table, the data is pasted in but the table does not expand and hence, the formulae does not get added to the rows outside of the table.
I have searched high and low for a fix but no joy. I have searched the data extraction VBA code with no luck (the code is an exact match) and no joy in the table properties. I have also checked the Options menu for Auto Format As You Type settings but all seems fine.
Does anyone have any ideas for me?
Thanks,
David.
Hi All again,
Would love to know if anyone has an answer for this but, in the mean time I have fudged the code to automatically adjust the size of the table based on the row number for the last cell of data.
Thanks,
David.
I ran into the same issue and it was driving me nuts. Found out that in a few columns I had dragged formulas down pretty far (they were IF statements to return nothing if the first column was empty) so I didn't see them.
So remove any formulas that are 'under' the last row of the table. Should clear up the issue.
The most common cause is due to differing number of, or mis-aligned columns (vertically stacked tables) or differing number of, or mis-aligned rows (horizontally stacked tables).
For simplicity, let us use vertically stacked tables to illustrate what is happening. Consider an upper table with 2 columns and a lower table with 3. If we try to insert a row to the upper table, XL attempts to push all cells beneath the table down, but ONLY the cells directly beneath the table. So in this case cells below the 2 columns will be pushed down. XL quickly realizes that if it pushes just 2 columns down, the third column in the lower table won't be pushed down resulting in skewing the lower table. XL makes no attempt to figure out how to move the lower tables. It just refuses to even try.
The same holds true for adding columns to tables on the left for which there are tables directly to the right. If adding columns to a table would result in skewing rows of a table to the right, XL refuses to help.
To keep this from being a problem we can do a few things:
Keep the largest tables on top and to the left and align all table first columns and first rows.
If only rows are added to tables, don't stack them vertically
And if only columns are added to tables, don't stack them horizontally.
Herewith is an example of enforcing expansion of a table after data was copied over to the bottom of the table. This is done by resizing the table. Originally the table wasn't auto-resized as it has additional calculation columns.
The first line of the code finds the last row of data and the second line states the range to which the table needs to be resized. The third line resizes the table to the new range.
Replace sXXX and tXXX with your sheet name and table name.
Sub ResizeTableXXX()
myLastrowOfData = sXXX.Range("A1000000").End(xlUp).Row
myNewRangeSize = "$A$5:$P$" & myLastrowOfData
sXXX.ListObjects("tXXX").Resize Range(myNewRangeSize)
End Sub
HIH