Possible to create Dimension and Measure groupings in PowerPivot in Excel? - excel

In an OLAP tool such as SSAS, I can create dimensions and measures, and Excel respects that grouping. For example:
Notice the Measures at the top and all the dimension groups underneath it. However, when I try creating these relationships from within Excel, it just groups everything based on the table it comes from. For example:
The only 'Measures' you can define (if you can call it that) is a calculated field when you click the 'Measures' icon in Power Pivot:
Is there a way to specific which of the fields are measures and which are dimensions within Power Pivot (Excel)? If not, is there a way to do this in Power BI (I also have that)? And if not, is the only solution for separating these properly doing it in something like SSAS?

Is there a way to specific which of the fields are measures and which
are dimensions within Power Pivot (Excel)?
I am afraid , there is no way to specify or rearrange these in a new created pivot table in Excel.
If not, is there a way to do this in Power BI (I also have that)?
Yes you could do this in Power BI, by Analyse Power BI dataset in Excel. The PBI dataset would separate measures and dimensions But, you would need to have a Power BI Pro license for this operation.

Related

How does ETL process map to MS Excel Power Pivot (Data Model)

Moderator please move to appropriate forum if required.
I use MS Excel 2016 for data visualization.
Can understand Extract means saving Excel data onto a spreadsheet and Transforming data means manipulating it in Power Query.
QUESTION:
But if I decide to load data to Power Pivot (Data Model) doesn't that fall back into Transform because you can
Create Calendar Table
Create Measures (or Calculate Columns if necessary)
Or does using Power Pivot (Data Model) fall under Data Modelling because you are no longer formatting, merging pre-existing data;
Rather you are creating new data (i.e. Calendar Table, Measures, etc) to merge with pre-existing data
Kindly clarify
Power Query (now standard excel 2016 in data tab): is an ETL (Extract - Transform - Load) tool. A standard example would be that you would connect it to your source ERP system, and make a product table. That wouldn't be an exact copy of the table, but could consist out of several tables, that are joined. You keep only the relevant columns.
Power Pivot: this is a data modelling tool, it allows you to create relations between data and attribute tables. It gives you the possibility to use time related measures (YTD, Previous Year, ...).
In general when you build your model in power pivot, you can choose to either load the data directly into power pivot (without power query). This is useful if you already have a datawarehouse in which the ETL process is done.
If you have an ETL process to execute, it's better to use power query, and load the data into power pivot. (option: load to data model).

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.

Is Power Pivot Multi Dimensional?

I created a multi dimensional pivot table in Excel and then used the following add on to generate the MDX: http://olappivottableextend.codeplex.com/releases/view/618637
The MDX was generated by Excel as follows:
SELECT NON EMPTY Hierarchize(DrilldownMember({{{DrilldownLevel({[Customer].[Customer Geography].[All]},,,INCLUDE_CALC_MEMBERS)}}}, {[Customer].[Customer Geography].[State Province].&[New South Wales]&[Australia]},,,INCLUDE_CALC_MEMBERS)) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME,[Customer].[Customer Geography].[State Province].[Country-Region],[Customer].[Customer Geography].[City].[State Province] ON COLUMNS , NON EMPTY Hierarchize({DrilldownLevel({[Customer].[FullName].[All]},,,INCLUDE_CALC_MEMBERS)}) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS FROM [Adventure Works DW2012] WHERE ([Measures].[Sales Amount]) CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
I then opened the Power Pivot windows and copied and pasted the MDX. It generated a two dimensional data structure.
I realise that Power Pivot is available because of the max row limitation in Excel i.e. it can deal with more rows. Is Power Pivot just a two dimensional data source? i.e. it is used to get all of the data into one place so that a standard Pivot Table can be used to analyse the data from a multi dimensional perspective?
It is the pivot table which is using mdx. Pivot tables came about around the same time as olap - they use the same technology. I think even if we create a pivot and point it at a server-side tabular model then the xl pivot will still be talking in mdx.
So the pivot table needs to work with mdx irrespective of the data source.
Power Pivot and Tabular models use a language called DAX. Tabular uses analysis services but is different from multi-dimensional .... it is tabular

DAX return ColumnName as the row value

Problematic data source
There is a SharePoint list with columns: Person, Customer, Responsibility, Week_1, Week_2, Week_n. Values are workload estimates in percentage ( and estimated hours are then calculated from avg. working hours).
Reasoning
The reason for this is that the list is much easier to use as there is no need to create new line entry for every single week per employee.
My take on the issue
You might already see my problem. For painless analytics there should be a similar data model as described in Reasoning chapter.
However it should be possible to create required data model. A new column would be created and it should get its "Week"-value from a lookup-function that could return "ColumnName". This is possible in Excel, but for the record I haven't succeeded in PowerBI with DAX functions.
What would be your recommendation?
I would recommend using Power Query to read from the SharePoint list and the unpivot the data. You can install Power Query in Excel 2010 and Excel 2013. It ships with Excel 2016 named as Get & Transform. And Power Query is available in Power BI Desktop. It is probably a better choice for this than DAX.

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