How to find data source of a slicer for a pivot table via the Excel UI? - excel

Note: I don't think it makes any fundamental difference, but I am working with pivot tables running on top of a PowerPivot model.
Example scenario:
Three tables in a model: SalesTransaction, BuyerCustomers, SellerCustomers, with a two defined PowerPivot relations:
BuyerCustomers.CustomerCode --> SalesTransaction.BuyerCustomerCode
SellerCustomers.CustomerCode --> SalesTransaction.SellerCustomerCode
I have a PivotTable defined using SalesTransaction as the data source.
Now, if I want to create slicers on both BuyerCustomer and SellerCustomer, in the Pivot Table fields window I can right click and "add as slicer" on either:
SalesTransaction.BuyerCustomerCode and SalesTransaction.SellerCustomerCode (the two columns in the transaction table)
BuyerCustomers.CustomerCode and SellerCustomers.CustomerCode (the individual lookup tables)
Either way, the behavior is identical. My question is: once this has been set up, how can one tell what a slicer is bound to via the UI in Excel? Other than being able to deduce the obvious association via column names, how does one tell?
Using VBA, one can discover the association like so:
ActiveWorkbook.SlicerCaches("Slicer_CustomerCode").SourceName
...which yields:
"[SalesTransaction].[BuyerCustomerCode]"
or
"[BuyerCustomers].[CustomerCode]"
....but as far as I can tell, there is no way to see this via the UI.

You cannot find the slicer TableName.ColumnName data source via the UI, you can only see the ColumnName.
As posted in the question, you can see both table and column names via VBA:
ActiveWorkbook.SlicerCaches("Slicer_YourSlicerName").SourceName
...which yields:
"[TableName].[ColumnName]"

Related

Calculated Field

I am trying to create a simple pivot table which will tell me how many community residents reported a particular problem, and what percentage of them reported each problem type. I have a data set with name, and then columns for each type of problem. Here's an small sample of the data set:
I have created a pivot table which sums each of these columns and also provides me the total number of people who reported any type of problem at all. Here's what I have:
I want to add a second column to this pivot table that gives the percent of times each problem type was reported. Sounds simple, but because of the structure of the original data set, I can't figure out how to do it. I can set up formulas outside of the Pivot Table which reference the table, but in doing so I forfeit the ability to graph the percentages on a pivot chart. Any ideas how to create a calculated field for this pivot table?
Just to be clear, what I want is something like this, except all contained in the structure of the pivot table:
Edit: I've changed the example of the data set. Here's an explanation of the pivot table. The values under the "# Reporting Issue" column are counts of all the 1's under each corresponding column in the data set. This meant that I had to add each row to the pivot table independently, as you can see here:
I'm open to the idea that I need to change the formatting of the data set, but I'm not sure of the best way to do it. This was set up initially because it allowed for easy compilation into a data table, but Pivot Tables seem to be a different story.
Hopefully this edit clarifies things.
You need to unpivot your data so that you turn it into a Flat File...something that the PivotTable can consume properly.
The easiest way is to use something called PowerQuery, which is baked in to Excel 2016 but available as a free addin from Microsoft for any other versions. Google PowerQuery Unpivot and you will turn up hundreds of tutorials, such as this one from my good pal Chandoo . PowerQuery looks slightly daunting at first to a first time user, but it is freakin easy once you get your head around how to use it. PQ is by far the best addition to Excel in years. PowerPivot being a close second.
If you can't install PowerQuery, then you can use your current data structure to make a 'staging pivot', and then drag the Values label that will appear in the Columns area to the bottom of the ROWS pane, like in this excerpt from a book I'm writing:
Note that my Year categories are equivalent to your Issues categories.
That will emulate the flat file layout you’re after. All you need to do then is turn this intermediate PivotTable back into a normal range, change that Values heading to Issue, and add a Count heading and you’ve got the flat file you need to build a useable PivotTable.
You can also use VBA. Google Unpivot VBA and turn up hundreds of results, including this blazingly fast code I posted some time back. (Look for the code under the —Update 26 November 2013— heading.)
You can also use the DoubleClick extraction trick.

PowerPivot Relationships Many to Many

The objective I am trying to achieve is to have 2 slicers in PowerPivot, ClientID and CSQName. When a ClientID is selected only the CSQnames that are related to that ClientID show up ,and vice versa
Relationship diagram link: https://goo.gl/photos/PnCZrnsXXTx3oFGh8
I am having a problem linking a many to many relationship in PowerPivot. A brief background on the application I am trying to build...
I am trying to combine a SQL database (IDM) and Informix SQL database (Cisco Call Data). The IDM database includes the Client Data and TBAS Open Case Data. Each Client has a specific ClientID. The Cisco database includes Call Detail Info and CSQNames(queue names). A many to many relationship exists, for example, a clientid can have multiple CSQname (clientid 3 has CSQ names of "A" and "B"). Also a csqname can have multiple clientids (csqname "Z" includes clientids "99", "98" and "97". Therefore I created an innerjoin table to create the many to many relationship called "Clients_CSQ".
I am trying to use this innerjoin table for both the "TBAS Open Cases" and "Call Detail". When I use this table for my filters, PowerPivot is stating that no relationships exist. Are there any solutions? If this does not make sense please let me know and I will try to specify. I have ready many posts but am unable to grasp how to make the DAX many to many relationship work with the calculate function. If someone can shed some light on the issue I am having it would be greatly appreciated. Thank you.
This really depends upon the data you are looking to report on.
When you add two slicers to a PowerPivot table, the available selections in each slicer will be affected by the selection in the other slicer IF and ONLY IF all of the fields in the Values section of the Pivot Table are reliant on the entries in both of the slicer fields.
In your case, it is possible to make this work (as an example) by creating 3 measures:
[Call Total]=SUM('TBAS Open Cases'[Case duration])
[Number of Calls]=COUNTA('Call Detail'[appname])
[Calls by Duration]=SUMX('Clients_CSQ',DIVIDE([Call Total],[Number of Calls]))
Place the last of these 3 measures in a pivot table with the slicers set to use 'Clients_IDM'[ic_client_id] and 'CSQ Name'[csqname] and "Hey Presto!"
The first two measures are straightforward enough. The third one is cycling through each entry in the only table that these two slicer fields have in common (Clients_CSQ) and performing a calculation using the data from your FACT tables. I have no idea if the [Calls by Duration] measure that I've come up with makes any sense with your data set, but hopefully the example will help you reach the solution you want. Again depending on what data you want to show it doesn't really matter if this measure returns junk, the important thing is that it's pulling your two data sets together.
Remember that as soon as you add any raw field from either of the fact tables to this 'unifying pivot table', the inter-relationship between the slicers will break. !!!BUT!!! there is nothing to stop you from linking the csqname slicer to another pivot on the same sheet which contains fields from your Call Detail table and likewise linking the ic_client_id slicer to a pivot that contains TBAS Open Cases data. In fact, the 'unifying pivot table' could be on a different sheet from your slicers, so you only see the two sets of data that you are interested in.
And ignore that warning about no relationships existing!

How to view a pivot table with actual column values like access in excel

I've tried searching this but couldn't find an answer because of the wording of the question. If it's been asked before please point me in the right direction.
I have the same exact data in Excel and Access, however, the pivot tables are viewed differently as shown below:
Excel view and data
Access view, same data
As you can see the pivot table in access has the actual values (Y, N) whereas in excel it sums up the values. I want excel to display the actual values like Access and not the sum.
I'll be switching over to Office 2013 soon and need to know how to do this in Excel 2013 since pivot tables were removed from Access 2010 in Access 2013.
I have also tried adding data to the columns section but doing so gave a harder to follow and different view as shown below:
I think this is what you are trying to do....
Looks like you will need an extra column in your table showing boolean values for yes/no as 1/0 for both house and car
Then, use those two new columns as your Sum of Values in the pivot table. Right click on the pivot table, go to options, and make sure that you have 'empty cells' set as blank. Then, for each value, you need this custom format
[>=1]“Yes”;[=0]“No”;
Don't copy and paste it in - it doesn't work (not for me anyway). Type it in manually.
I got the info from here (which probably explains it better) http://chandoo.org/wp/2012/05/07/displaying-text-values-in-pivot-tables-without-vba/

Is it possible to filter data used by pivot table based on filtering the rows in a source table in Excel?

I have developed a dashboard in Excel 2007 that uses one source table in a sheet (being filled with a query on our data warehouse) and multiple pivot tables making different cross sections on this data.
I use the GETPIVOTDATA in almost a hundred formulas to give me the right value for a specific indicator in my dashboard.
This all works fine. However I now have received the question to make the dashboard for 5 different segments. As you can imagine I don't want to create 5 different workbooks for this and need to maintain the dashboard logic on all of them.
So my question is the following. Is it possible to automatically (through VBA or any other means) filter the results in my source table which is the source for my pivot tables and thus for my dashboard values.
So schematically:
DATABASE_VIEW --> SOURCE_TABLE --> 12 pivot tables --> 100 GETPIVOTDATA functions
Preferably I would like to load all the segments in the source_table (one view on my database) and then filter the data in the source table, which results in filterd source_dat for my pivots. This way I can (without requerying the db) quickly change between segments in the dashboards (refreshing pivots only).
Data in the source table has the column: CUSTOMER_SEGMENT available to filter upon.
Any help is appreciated.
Geoffrey
You can manipulate all external data connections and internal pivottables through VBA.
To make it a double learner for you I recommend using the Record Macro button and then changing a filter in your pivot table and also change your SQL query a bit.
You will now see that in the recorded macro the related properties of that Pivottable/query are stated. Filters and SQL are simply Strings in the VBA code, thus you can alter certain bits to get different filters or "WHERE Cust_ID = " comboboxCust.Value kind of things.
Doing it through VBA codes to change the filters and SQL is usually more speedy then having it all interactively related with the standard Excel tools (Functions, parameters, linked filters, ...)

Measures as attributes when consuming data from a Power Pivot

I created a Power Pivot workbook that has information from our store (the plan is to connect to this document and consume the data), basically is something like this.
CostumerID | QtyPurchasedProductA | QtyPurchasedProductB | QtyPurchasedProductC ...
Everything is working fine when I use the Power Pivot data as a Pivot Table, but I when I upload the workbook to a SharePoint site and connect to the PowerPivot from another workbook, all of the measures (QtyPurchasedProductA , QtyPurchasedProductB, QtyPurchasedProductC) are shown as attributes instead of measures.
This happens with pulled from my database as well as custom DAX fields.
Any idea why this is happening? Is there a way I could specify on my Power Pivot Central Document? (the one I uploaded to sharepooint)
Thanks
When working with a pivot table (or pivot chart) based on a PowerPivot container local the workbook, Excel will "automagically" apply an aggregation function (Count, Sum, etc) to any field placed in the values/details section. My guess is that this "feature" is intended to make PowerPivot more user-friendly for the average business user...however I think promotes bad habits.
So, you'll want to go back in the local copy of your PowerPivot workbook and explicitly defined the measures. The easiest way to do this is to select the column and choose from one of the listed aggregation functions (see below):
For complex measures, you can use a DAX expression in the calculation area to define a calculated measure.
Once that's done, upload the PowerPivot workback back to SharePoint and you should see the measures when you connect to it and try to use it as a data source in other workbooks.

Resources