Count of related column doesn't work in Power Pivot - excel

I have few tables in my data source in Power Pivot:
One is a "Calendar" table from Azure Marketplace (http://datamarket.azure.com/dataset/boyanpenev/datestream) that I'm using for user friendly date representation. Clients table that has basic information about clients (ClientId, Client Name, Recent Address). Each clients may have multiple Accounts (AccountId, Account Name, ClientId). And I have AccountActivity table (AccountId, Date, Income). I've setup relations between tables accordingly.
I need to build a resulting table that is based off AccountActivity and will have Date(Month, Year), Sum of Incomes, # of accounts and # of clients. I was able to get everything except # of clients. Once I'm adding # of clients into the table it starts to complain that there is no reference and instead of showing proper # of clients it is showing total # of clients that does not have any relation to the accounts. Is there any way of making it work or I will have to add into AccountActivity ClientId column?

You shouldn't need to add the ClientID to your source. You can just make a calculated column in your PowerPivot model. I recreated what I think you have
I made 3 tables with fake data that includes 4 clients, 6 accounts:
I added them to my data model and then added the DateStream to my model and created relationships.
Then I:
Went to the activity table in my model and added a calculated column [ClientID] with formula =related(Client[Client ID]).
Created a calculated measure [# Clients]:=DISTINCTCOUNT(Activity[ClientID])
Created a calculated measure [# accounts]:=DISTINCTCOUNT([AccountID])
Created a calculated measure [Sum of Income]:=SUM([Income])
Then I created a pivot table. These calculated measures seem to work across all of your dimensions.

Related

Append a column of a few tables into a single bigger column

I'm having a problem while building this sheet and i'm not being able to find a solution.
The problem goes like this:
This is a marketing agency that wants to build quotes for their clients in a more automated and simpler way they do today.
There is a master table that the user must put all products they have to offer and their prices
from this master table, I've created 5 other tables with power query, So they have an user interface to fill the number of products and price adjustments they want to quote. Also some products price depends on the price and quantity of other products. that's why I needed to separate it.
Now I need to bring them back together so I can use it as a source for a pivot table to build their report.
I've tried a few things:
Making them all a joined source for pivot table, but as they don't have any exclusive fields it failed.
They have a different number of columns and rows, so putting them below each other won't work
I've also tried =Table[Total Value]:Table2[Total Value], but they are joined side by side, and I need them one below each other.
I haven't tried VBA, but it's not out of the question.

Using a fact table column for Power Pivot slicer

I have a couple measures in a Power Pivot data model to analyze activities by a group of consultants:
Total Activities = calculate(DISTINCTCOUNT(ServiceRecords[Activity ID]))
Service Status = if([Distinct Activities]>=5,2,IF([Distinct Activities]=0,0,1)). >> This is to assign a numerical status to customers based on volume of activities
I have a pivot table set up to slice by consultant and show the output of these measure against clients in rows.
I run into trouble when I add a new fact table (Addressable) to the model - this contains Yes/No feedback from sales as to whether a particular account is relevant for a particular consultant. This is linked to the original fact table with two typical index tables classifying consultants and classifying accounts. But the direction of the relationship is inwards from the index tables to this table.
What I'm trying to do is add a second slicer by the Yes/No field in "Addressable" to filter only the records that show Yes or No for the chosen consultant. I thought a CROSSFILTER measure was supposed to do this, but it ends up filtering the data behind calculation of the existing measures instead of just filtering the view. Any idea what I should be doing here?

Excel Data Model - Creating a many-to-one summary table by mapping table and column names

I am trying to create a summary calculation on a set of tables which I have added to an Excel data model. I have 5 tables with the following columns:
Datetime (UTC)
Measured Data 1
Simulated Data 1
Measured Data 2
Simulated Data 2
etc.
I have created a master Date-time table which links these 5 tables together on their UTC date-time column.
My query is how to optimally create calculated fields on each of these tables without needing to explicitly specify the calculations on each individual table, as is the case with PivotTables (I need to select the specific measured and simulated data columns from one individual table in the data model). Instead I would like to be able to map all measured fields to one column and all simulated fields to another, and then use filters to select out the fields (or groups of fields) I want to compare.
I started by creating a summary table which lists all my tables in my data model by name along with the names of measured and simulated columns within each. However, I'm unsure what the next step should be. This seems like a pretty straightforward problem, but it has me stumped this morning. I'd appreciate any help. Let me know if I haven't fully explained anything.

Combine pivot tables with different but compatible measures?

I have a pivot table that displays agencies in rows, products in columns and sales units as values. I have to make up a report in this format:
Data is coming from an SQL Server Analysis Services and the "Estimate 2015" measure is a different measure (but uses the same dimensions and granularity so it is in fact possible to display the values side by side).
I could add a separate pivot table for the estimates, but then filtering or sorting the two tables will make them loose sync.
Is it possible to somehow align or combine pivot tables with different measures nicely?
if you are using Excel 2013, then you can use the data-model feature with standard pivot tables.
You need on your workbook:
3 dimension tables for agencies, products and year. All rows must contain distinct values (Agency A-C, Product A-B, Year 2013-2015)
2 fact tables: the one with historical data (from SSAS), the second one with your forecast datas
then you just create a Pivot table from any of the Dimension table. At this step, check the box "Add this data to the Data Model".
You then pull the Dimension field from the three dimension table on the Pivot column and rows. Choose both value fields from the 2 fact table (Quantity).
Excel detect missing relationships. You have to build them manually between the two Facts tables and the three dimensions (total 6 relationships)
In this Excel-file you can see an example with your sample datas.
You can find on the web some step-by-step explanations like How to Build PivotTables Using Excel's Data Model Feature

Powerpivot duplicating values

I have two tables:
First table contains sales pipeline information for accounts (contains pipeline ID, accountID, and pipeline value). Each account IDs have multiple pipeline ID
Second table includes the number of employees per account.
I included these tables to powerpivot, and I created relationship based on account ID.
I would like to create pivot that tells by Number of employees & Pipeline value by account ID and PipeID.
However, when implemented, it repeates all pipeID for each account. Even those pipeIDs which are not related to the account.
http://i.stack.imgur.com/WY1Ga.png
Could someone point me to a right direction to how I tweak the pivot to show only relevant pipeID?
I would appreciate any help you could provide...
thank you!
The numbers repeat in your pivot table because Number of Employees is not related to Pipeline ID. This is Excel's default reaction to missing relationships. To get rid of the repeating numbers and keep this pivot table as is you need to find a way to relate number of employees to a pipeline ID.
If I were modeling this, I would have a separate table that is just distinct Account IDs, to make it it's own dimension. Then have your two tables you mentioned in the question.
If you were simply writing a query against this data, how you would connect pipeline ID to number of employees? To which pipeline should an employee be attached ? If there is a way to do this manually/in a query, adjust your two tables to both include the fields on which you would join. I don't think you would be able to relate Number of Employees to Pipeline ID, so I would remove Pipeline ID from the pivot table. Then the numbers should be correct. You would want to create another pivot to show pipeline by pipeline ID per account.

Resources