I want to use several GetPivotData functions, retrieving data from the same Pivot table. I want each of them to retrieve different data based on a filter value.
For instance:
Get Pivot Data for Month:January
Get Pivot Data for Month:February
Where Month is a filter on the Pivot. Is this possible using a formula?
I hope this will solve your problem. Try this workaround from Microsoft:
https://support.microsoft.com/en-us/help/287736/getpivotdata-formula-is-automatically-created-when-you-try-to-create-s
When you change the month, the value changes too. But make sure that there are no hidden items (because if not, you won't get an accurate #/data).
see the screenshot below where the Month to choose is based on a cell reference as an argument in the GETPIVOTDATA formula:
Victor,
The Pivot tables won't work like you intend to. All data that your formula shall retrieve must be visible at the same time. I suggest that you arrange for some space on your worksheet and apply the solution proposed by Scott.
NB: If you want to deal with data added month by month, for example, there is an Pivot table option to automatically add new values to the filter. Then in your formula you can use IFERROR to show blank cells when there is still no data available.
Regards,
+Daniel+
Related
I am new to DAX and Power Pivot, I apologize in advance if there is a similar thread I did not see. I am using Excel 2016, I need to use USERELATIONSHIP in the CALCULATE function to use an inactive relationship in the data model (I need it for a slicer).
I am using this formula =CALCULATE([Count of Fiscal Week Identified],USERELATIONSHIP(Table[Fiscal Week Identified],Week[Week])) to create a calculated field I need to add to a pivot table.
I just need Excel to generate the pivot table on the left in the screenshot using a calculated field inserted in values, and the field 'week' in rows (having an inactive relationship in the data model). When I tried using the formula above, I get the table on the right which is completely different from the table on the left, and I cannot figure out why... I need this to include the pivot table in a slicer. Any help would be very much appreciated. Thank you in advance!
Regards,
The problem is that even though you are creating column using USERELATIONSHIP, the relationship isn't active when this column is evaluated in Pivot Table. So you need to use a Measure. Is the below the expected result?
If yes, then create a measure like this:
I have a Pivot table like this
I try to convert this to a user table with all names and have the data listed by day
I tried to use VLookup bus not being succesfull in separating the code in a column structure.
Apologies for the pictures I tried to add a table structure but it didn't work out.
Any suggestions please?
My approach is to isolate regions based on the date you provide, then vlookup on that area, here is the formula, you can try:
C18==IFERROR(VLOOKUP($B18,INDEX($B$3:$B$15,MATCH(C$17,$B$3:$B$15,0)):INDEX($C$3:$C$15,IFERROR(MATCH(D$17,$B$3:$B$15,0),13)),2,0),"")
I have been struggling with this issue in the past days and haven't found yet any solution.
I have a simple table (not a pivot table) and some slicers attached to it. I want to 'simply' show selected value/values of the slicer in a cell. It implies of course to make the cell update automatically according to the selection.
Some of the solutions I found suggested using two pivot tables, one main for the regular data and the other hidden to capture the selected filters. The problem is that I am not working with a pivot table, but rather a simple table.
I also tried getting distinct values of the table column, but I couldn't perform it properly without getting the hidden values of the filtered table too.
Is there any way in Excel to do this simply?
Thank you!
You can follow the below steps to achieve your result
You will have to insert a serial number column in your table
After that insert the below formula above the header or anywhere you want to display the selected value
The formula in C2 is
=INDEX(Table1[Data 2],SUBTOTAL(5,Table1[S.No]))
I am trying to fill in my Summary Table with the data from a pivot table I have created. Within my summary table, I am trying to pull the closing number of the specified stock from the specific day. I believe the VLOOKUP function is the best way to do this, but I keep getting a #N/A. What is the proper way to write the VLOOKUP? My VLOOKUP Function looks like:
=VLOOKUP(C7,'Pivot Table'!$4:$3914,1,FALSE)
Do I need to restructure my pivot table or use an HLOOKUP?
You can use the MATCH() function in the VLOOKUP to find the correct column, but you need to look for the date first then the ticker column:
=VLOOKUP(E$6,'Pivot Table'!$5:$3914,MATCH($C7,'Pivot Table'!$4:$4,0),FALSE)
Then drag it over and down.
OR
If you want to look for the Ticker first you can use a HLOOKUP with a MATCH():
=HLOOKUP($C7,'Pivot Table'!$B:$N,MATCH(E$6,'Pivot Table'!A:A,0),FALSE)
OR
You can use INDEX() with two MATCH()
=INDEX('Pivot Table'!$A:$N,MATCH(E$6,'Pivot Table'!A:A,0),MATCH($C7,'Pivot Table'!$4:$4,0))
You may access the pivotCache directly:
Use the names of your pivot table fields either by :
1) Looking at the names of the fields in the field list
2) referring to your data table and seeing what names you use, or
3) using tabular or outline layout(instead of compact - and the field names wil come up in the rows and columns dropdowns).
Then use:
=GETPIVOTDATA("Close",'Pivot Table'!$A$4,"correctNameofDateField",E$6,"correctNameOfTickerField",$C7)
You can drag this across and down.
I am attempting to make some reports in Excel using a pivot table of a Sql server view. One of the customer requirements is to be able to filter the reports based on a date range they select, which seems reasonable. The end user process needs to be fairly simple, so my preference is to have a cell for begin date and one for end date and allow the user to
enter these and refresh the table.
There are two problems which I haven't been able to get past:
Selecting a date filter doesn't appear to provide any way for me to reference a cell as a source for the value. I have to put it in at the time.
It seems as if it is only possible to define a date range if I am grouping on the date field. For some of the reports, this violates the specification. The Report Filter section of a pivot table only seems to allow me to filter by individual values rather than a range. This gets unmanageable on real data which might have hundreds of dates to go through.
One thing I have tried is to create an intermediate table without any aggregates columns in a separate sheet in the same workbook, and then filter that. This hid the columns correctly in that intermediate table, but had no effect on the pivot table which derived from it.
Does anyone have ideas for how I can make this work? It seems like a fairly obvious use case - is there something I am missing about how pivot tables are supposed to be used?
The easies thing you can do is changing your pivot table query on the fly.
When the source cell is changed (Worksheet_Changed event), append " AND WhateverDate > '1/1/1111'" to Me.PivotTables("Your pivot").PivotCache.CommandText and refresh the pivot.
I remember I solved a similar requirement some years ago by making the SQL query dynamic (i. e. putting it together as a string in VBA, and using the cells with the range values in the where condition). ant the VBA macor was then called with a button labeled "refresh".
But I am sorry do not have this code available any more, I just remember the general idea.
This has been dead for a while, but I thought I would post a different method. add a formula to the source table that returns a '1' for thing you want, and a '0' for things you don't, and then add a filter in the pivot table that filters only the '1'.