DAX return ColumnName as the row value - sharepoint

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.

Related

Possible to create Dimension and Measure groupings in PowerPivot in 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.

Excel VBA: Create a table from the permutation of other two

I want to generate new entries as two tables say how.
It could be like a vlookup but I need more than one "result entry" per "original entry"
I would like to know if there is a single formula, or I should use macros or maybe even python.
I really also didn't know how to search this, maybe a link would be useful.
This example will explain better than me what I need.
Example:
Table 1. SALES
Table 2. Tells which primary materials are used in each product (product components)
Result table: Tells the amount of primary materials by product and client
You could use Excel Power Query if you are looking to keep things simple.
We use Office 365 in our office and we frequently use Power Query for things like this.
I tossed your data into two tables and configured the power query to output the aggregated data per client, per material.
The output will be updated if you modify the tables and click the refresh button on the data tab.
Excel example (using Office 365)

Practical tips on documenting Excel Queries, data model tables, pivot tables?

Building a BI system (dashboards) in Excel using imported tables (from excel files). We're using Excel 2016 query, data model, measures using DAX expressions, resulting in more pivot tables (some of which are reloaded into data model), etc.
My question: is there "best practice" on 1) naming these data elements and 2) documenting these bits to have a more complete system documentation.
Background: I'm the senior "hacker" munging these things together. But I need to move this towards being sustainable. I did some prototyping work and when I went back a week later it was challenging to reconstruct my thoughts and relationships...
I've seen folks refer to use of PowerBI flow diagrams to support documentation; but it seems to be more of the "icing on the cake" than the "cake" itself.
So what "bread and butter" documentation approaches have you, more experienced developers, taken to ensure that your systems are clearly documented so that others can pick up where you left off???
For naming, I follow the Kimball Group's advice for data warehouses/marts, e.g.
https://www.kimballgroup.com/2014/07/design-tip-168-whats-name/
I rename many/most Query steps to reference the column or table name, e.g. Added Custom => Added Customer Name, Append Queries => Append Customers. The idea is to be able to pick the right step first time when coming back for maintenance.
You can select all the Queries in the Query Editor window and copy their code, then paste it into Word etc as the starting point for your documentation. You can also screen-shot the Query Editor's Query Dependancies pop-up.
For the Power Pivot logic, try this solution:
https://powerpivotpro.com/2014/03/automatically-create-data-dictionary-for-your-power-pivot-model/

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.

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