How to create m2m relationship in PowerPivot - excel

So I am trying to link an employee metrics pivot chart with an employee project table with one slicer. I want an employee slicer that manipulates all charts but the data is coming from 2 different places (SQL, Sharepoint). When I try to create a relationship based on Employees I get the following error: "The relationship cannot be created because each column contains duplicate values. Select at least one column that only contains unique values."
So one chart has quantitative items while the table has qualitative items and I want one slicer to manipulate both at the employee level.
I want to see all the data on both charts for the selected employee, and not just single items linked by unique values. I can use unique values, and have created relationships that one slicer can manipulate however I only get one record at a time that way and therefore the slicer has thousands of buttons (one for each record).
I wouldn't think this would be that difficult and I hope it's really not.
Please Help!

M2M relationships in PowerPivot will most likely cause more headaches than solutions unless you are aware of what you are doing. After some thought, I realized that I really do not want an m2m relationship because it would result in junk data for what I wanted. I just wanted to start my answer off acknowledging that I did not achieve an m2m.
So if you want to link SharePoint data to Excel here is what you need to do:
Export SharePoint data as an RSS feed. If this is something others will need to refresh then the rss file will need to be stored on a shared drive.
Add PowerPivot if you have not already done so. In PowerPivot get external data from other sources (rss feed) then add your file. To link data you will need a Unique ID to join tables on.

Related

Table with variable number of rows in MS Office mail merge [duplicate]

I'm creating a compliance mailing for my organization, the mailing will include merge fields that identify the office location, physician, and SiteId. The mailing will also include a table of information that is dependent upon the particular SiteId.
I'd like to use the import table function of MS word and set up a query that references a merged field (SiteId) so that the inserted tables populate the appropriate data for the particular site. I'm unable to do this.
How can I set up this document so that I can import only records from my source (an ms access query) that match the SiteId merge field?
Word's mail merge does not support one-to-many relationships. There are ways to coerce it, but only one of them can yield a table as a result and over the years it has become less and less reliable as Microsoft has not regarded it as important enough to maintain...
What you need to do is set up a query that provides ONLY the information you want displayed in the table, plus the key (SiteId). It's best to sort it so that all the SiteId entries list together, and are in the order the data will come through in the mail merge data source.
On the Insert tab go to Text/Quick Parts/Insert Field and select the Database field from the list in the dialog box. Click "Insert Database" and follow the instructions in the dialog box to link in the data. Be sure to set the Query Options to filter on the first SiteId from the data source. When you "Insert Data" make sure to choose the option to "Insert as a field".
This inserts a DATABASE field in the document which you can see by toggling field codes (Alt+F9). The field code can be edited and what you need to do is substitute the literal SiteId value you entered for the query with its corresponding MergeField.
When you execute the merge to a new document that should generate a table for each data record corresponding to the SiteId for the record. But, as I said, Microsoft hasn't done a great job of maintaining this, so it may require quite a bit of tweaking and experimenting.
If the results are not satisfactory then you should give up the idea of mail merge and use automation code to generate and populate the documents.
You can find more (albeit somewhat out-dated) information on this topic at http://homepage.swissonline.ch/cindymeister/mergfaq1.htm

Filtering From 2 different tables in DAX

I am having a little trouble figuring out how to properly filter from the one side through a many relationship and back through to another one sided table.
The issue is that a Customer can have multiple accounts which can have multiple Customers.
In the attached image I am trying to filter from a Center# through the All Customer level and then add a filter on the List table to get the correct open accounts.
So the example would be I am looking for all Customers that are associated with Center A and are attached to an account type A.
The inactive one to many relationship from All Cust -> All Accts is what needs to be active instead of the All Cust -> Open table.
I am currently using:
CALCULATE([Cust Enrolls],CROSSFILTER('All Cust'[All Customer Number],'Open'[Primary Customer Number],Both))
to be able to filter for the account type, but that table's customer is just the single primary customer.
Any ideas on how I should either rework the model or how to create the correct measure?
Model
I would recommend re-working your Data Model so that you have a clear 1-M for each dimension table to your fact tables. This will save you a tremendous amount of time and headaches now and in the future by structuring your data properly.

How to visualize more attributes of a dimension in Pivot table in Excel 2016

I have a SSAS cube where one dimension is "User".
User has many attributes, say "Email", "Mobile Number", "Address" and (many) more.
I build a Pivot table in Excel 2016 where I can easily find which Users, for instance, placed orders in the current month.
Now, I want to visualize for each of these users several of the possible attributes: I just need to easily get the list of email and mobile numbers of the users that placed orders in the current month.
If I drag the required attributes in the Pivot table though, these are used to further split each row: under each User in the Pivot there will be a level with just one Mobile Phone and this will be further divided in one email and so on.
What I need is, instead, keeping the division of the Fact "Order" only by the dimension User, and for each User to just visualize some more fields.
What's the best way to achieve this?
The only way we can think of so far is to have an additional attribute with the concatenation (comma separated?) of all the needed information. But this is honestly horrible. The aim should be to have each of the additional attributes in its own excel cell.
I think you are looking for something like this ...
Pivot-Table options -> Display -> Classic PivotTable layout
For each field on your pivot table, Field Settings->Subtotals->None
From this raw data ...
And the options above, I generate this Pivot Table ...
I can't comment on Excel 2016, as I'm using XL 2013.
But in my pivot table, I can right-click on the default-displayed value for the dimension (I guess this would show the user Name for your User dimension - for me it's a Products dimension).[
Then select "Show Properties in Report", and select the one you want.
What it shows is what you get in the Tooltip popup when you hover over the cell. It doesn't seem to treat these extra values as extra dimension levels, with a Cartesian-product relation to the leaf-level you're looking at: it correctly just reads one value per leaf member.
Is there maybe some switch in your dimension design you need to flip to get Excel to do this? My dimension has these "properties" as dimension attributes, with AttributeHierarchyVisible=True, AttributeHierarchyEnabled=False.
I only have 2 of these defined (Current Product Code and ID). For some reason this Excel functionality also includes the immediate parent level of the leaf level in the hierarchy (Category) as a "property".

Create Excel Contact database

I would like to create a database based on the following reasoning:
I want to assign to each contact I have some tags for his abilities, for example, so there will be a column called "abilities". So I was thinking about creating a list of possible abilities (probably on a second sheet), lets say "play football", "cook", "ride a bike" and define that "Mike" can "play football.
For this to be useful I would also like to know how it is possible to be able to filter my contacts by ticking on the list of abilities I am looking for.
There are a couple of ways to tackle this.
1) Make a table that has contacts and abilities all together. This means that you will repeat the contact info if a person has multiple abilities. Each row will be the unique combination of contact + ability. If you want to limit the options for ability to specific choices, create your list of abilities and use data validation to create a drop-down list of these values in your abilities column.
2) Make 3 tables: 1-Contact, 2-Abilities, 3-Map of Contacts to Abilities (each row contains the unique identifier for a contact and the unique identifier for an ability). I'm not sure if you really intend to make a database or just something in Excel that works. If you can use PowerPivot, that would be a good solution without needing another application to create your db. Bring your 3 tables into PowerPivot. Create a relationship between table 3 and table 1. Create a relationship between table 3 and table 2.

Portal displaying data from two tables

I have two tables which both include a date field. Currently I have two portals, one for each table (occurrence).
Is it was possible to display the results of both of these in one portal, and sort by the date?
Technically a portal can only display records from one table. If you need to join two tables then you have to do this manually or change the design and use one table instead of two (since you want them in the same portal, then the tables are similar to some degree; maybe this similarity can go into its own table).
Sometimes developers use the so-called virtual table technique: they create a table with, say, a field with the record number and a bunch of calculated fields that pick their values from elsewhere, for example, from prefilled global variables. They create a portal to this table, set up the relationship to display the required number of records, and write the code to fill these variables. This way they can show data that isn't stored in any table, combine tables, etc. But it's an arcane technique, I would recommend it only as the last resort.

Resources