Measures as attributes when consuming data from a Power Pivot - sharepoint

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.

Related

Querying single data points from the Excel Data Model / Power Query (Get & Transform Data)

I'm using an up-to-date version of Excel 2016 (via O365 E3 license) and using Power Query / Get & Transform Data. I can successfully create queries and load them to the page. I have also successfully created Power Pivot reports.
I would like to query single data points from the data loaded via Power Query. For instance, imagine a dataset called DivisionalRevenue with:
Date Division Revenue
2016-01-01 Alpha 1000
2016-01-02 Alpha 1500
2016-01-01 Beta 2000
2016-01-02 Beta 400
I could easily load that to an Excel workbook or include it in the data model and create a power pivot. However, Power Pivot doesn't always meet my requirements, particularly around how the data is displayed on the page. In order to achieve my goal I may want to be able to query individual data points.
I would like to have a cell on the page with a formula in it that I can use to query individual data points. If it was in a pivot table I could use something like:
=GETPIVOTDATA("Revenue",$A$3,"Date",DATE(2016,1,1),"Division","Alpha")
The lookup values (date and division) could be retrieved from a cell on the page or hard-coded into the formula. This is a requirement for several reports I'm working on.
Or, I could add a combined lookup column with Date and Division concatenated and use a vlookup to pull the values like:
=VLOOKUP("42371Alpha",I9:L13,4,FALSE)
Finally, I could use a combination of INDEX and MATCH to identify the correct row number and then pull the data.
All of these solutions require the data to be loaded onto a sheet. One requires a pivot table that has to be refreshed to work properly. The other two require creating arbitrary lookup columns so that you can match a row based on more than one field (date and division in this example), and you have to ensure that that lookup field's formula is properly extended down the length of the data table. In both cases I would have concerns when sharing this workbook with my colleagues in case someone affects the rather fragile setup of the pivot table or the lookup.
So, what I truly want to find is something equivalent to pivot table querying against a dataset.
** This doesn't exist, but I would like to know if something like it does **
=GETQUERYDATA("Revenue","DivisionalRevenue","Date",DATE(2016,1,1),"Division","Alpha")
Does such a thing exist? Can such a thing be done? Can I retrieve arbitrary data points from the dataset created through Power Query / Get & Transform Data?
I think that what you want are cubefunctions:
Some Background
How to easy create cubefunctions from a pivot table
There is a feature in Excel that allows you to query off of a PowerPivot model, but it's not highly advertised for some reason.
Once you have the data in your PowerPivot model, go to your Excel -> Data tab -> Existing Connections -> Tables tab
From there, choose the table that you want to start with. Once that table's data is on your excel sheet, you can actually right click that table -> go to "Table" -> "Edit DAX"
From there you can enter the following DAX function, as an example
EVALUATE
FILTER(SampleData,[Date]=DATE(2016,1,1) && SampleData[Division]="Alpha")
Make sure to choose Command Type=DAX in the drop-down. Here's how it looks on my screen:
To further improve your querying power, you can install the optional "DAX Studio" plugin for Excel, which allows you to write custom DAX queries and then export the results directly back to an Excel sheet.

Excel 2010: Automatically combine multiple tables into one dataset

I thought there would be a simple way of doing this, but unfortunately I have not come across one. My company has an Excel workbook with 12 sheets (1 for each month), into which I enter sales data as accounts are written. I reformatted each month's data into tables, thinking that this would provide an easy reference to gather the data into a pivot table that joins all the months and would be updated as I enter data; however, a pivot table based on multiple sets of data allows highly limited manipulation.
So what I want to do is create a new table that is automatically populated as I enter data in any of the 12 current tables, to combine them into a master listing. I have tried doing a query, but when I try to set up the data sources, it doesn't recognize my tables. I tried Power Query, but I couldn't get it to update the data as I updated the source. Consolidate also was not a useful feature, as it required all the data to be somehow calculated, and my columns need to simply be copied over, not summed or averaged.
As you can probably tell from my explanations and terminology, I'm no Excel expert. I don't know what VBA even is, let alone know how to use it, but I've seen it mentioned a lot, so I figure at some point in my life I should learn it.
Is there a formula or some other Excel 2010 feature that can automatically copy all of this data onto one running list, and keep it updating as I enter data in the source tables? It would have to run automatically.
I believe your end goal is to have a pivot table which consolidates data from each of the individual 12 sheets/tables and not really to have the intermediate "single running list which is an aggregation of all the 12 sheets".
If so, I suggest to create an Excel Pivot table directly based upon the 'Multiple consolidation ranges'.
To start, create a new spreadsheet and select a cell (say A3) and use the click sequence Alt+D+P, this will bring up the PivotTable and PivotChart Wizard, and proceed further using the third option - 'Mulitple consolidation ranges'.
I will have to refer you to the below site for a detailed step by step instructions on the above: http://www.contextures.com/xlPivot08.html
Please be aware that the Difficulty level for this solution is Medium, suggest you to bookmark the solution from maintainability reasons, in case you choose to implement it.

How to enable user to edit Power Pivot lookup data

Coming from the corporate data warehousing solutions world I found Power Pivot to be surprisingly functional tool that could help to bring BI into small bussiness. In order to educate myself in this area I'm doing a small project for a friend who is a building contractor and asked me to help analyse his costs against different projects. The issue is that some data needs to be provided by user and here is where my narrow knowledge of Power Pivot is starting to show up.
My base data is coming from accounting system. I have access to company books via SQL Server connection, I can import Invoices, Clients, Suppliers, Accounts and all other entries. I made all
the connections and can present data in an easy way in a Pivot table which alone impressed my friend a lot. I was impressed myself how easy and straightforward it was compared to some reporting tools like Microstrategy or Business Objects which I use every day.
What is missing in the accounting system is Project information, say Client has 3 houses which my friend is working on, each of them should be treated as a separate project that we want to calculate profit on. Do do that I need some manual input such as assigning Project to Cost invoice add a category (Materials, Services) etc.
Initially I wanted to create a two lookup spreadsheets:
Projects where project name, valid from/to, etc. would be entered manually (or imported from CRM application in the future) and Client which would be selected from a dropdown list (ideally sourced directly from the power pivot Client table)
QUESTION 1: how to add a dropdown list of Clients coming from Power Pivot table?
Invoice relation table which would hold some data from power pivot Cost Invoice table (invoice number, supplier, date etc.) and then a dropdown list with projects (from the first spreadsheet) and cost type. Tricky part is that I would like invoice list to be refreshed automatically when new invoices are registered but I don't want to loose any data added manually against them!
QUESTION 2: how to design such spreadsheet to be populating new invoices automatically but maintaining data linked with it? I was thinking PivotTable with some data next to it but it seems like a very volatile solution, say invoices are sorted by invoice number (which is different system or each supplier) and a new one can show up in the middle of the table, then all projects that were manually added after would start pointing to the wrong invoices.
Last resort for me is to create an MS Access database for storing/updating lookups but then all the mess with creating ODBC connections etc. comes into play and in my opinion it's defeating the idea of neat PowerPivot Excel spreadsheet...
Any ideas are welcome!
in general you can design an excel table that holds manual input data and feed that table into PowerPivot (via linked table).
as for the drop down info based on database data i suggest using power query. this tool lets you connect to various sources, do some data wrangling and then output that data into excel. these outputs can then serve as data range for excel based drop downs.
take a look at Power Query e.g.here: https://support.office.com/en-in/article/Introduction-to-Microsoft-Power-Query-for-Excel-6e92e2f4-2079-4e1f-bad5-89f6269cd605 or here https://www.youtube.com/watch?v=LACjRvxl_2w.

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, ...)

Conditionally linking cells in Excel 2007

I have a series of worksheets in an Excel spreadsheet. Each worksheet details a set of requirements, along with each component necessary to make that requirement happen, broken down into the following layers: UI, backend, services, database, and misc.
So columns like this:
Req#, Description, UI, Hours, Backend, Hours, Services, Hours, Database, Hours, Misc, Hours
Now I am trying to selectively take some of this data and place it into another worksheet to specifically detail what all has to be done in a given layer, for example the Database layer.
So I would select only the Database (and related hours) column, and link to them in this new "Master Database" worksheet. I don't know how to do this in Excel.
For comparison though, here's what I'd write as a SQL query:
SELECT Database,DatabaseHours
FROM ReportsTable,FeedbackTable,AdminTable
WHERE Database IS NOT NULL;
I just don't know how to make these relationships very easily in Excel.
I would look into using Pivot Tables. If you have all your data in an Excel sheet, creating a pivot table on another sheet will allow you to summarize data however you want.

Resources