Excel Data Model not detecting relationships - excel

I am struggling to get this simple data model to work in Excel's Data Model. I have 3 tables. One table is a large budget. The second table is a small budget. The last table is transactions. Each transaction is allocated to both a small budget and a large budget. I think my issue is because we can't use bi direction filtering with Excel's Data Model. When I try to use a field from the transaction table, there is no relationship to any of the budget table. Is there another way to set this up?
Please see pictures attached. Thanks!!!

You're correct that bi-directional filtering is not an option in Power Pivot, and so filtering only ever propagates from the one side to the many side. Which, in your case, means that the Transaction table cannot filter either of the other two tables.
Have you tried adding Calculated Columns to the Transactions table to pull in the Big Budget and Small Budget Values? For example, for Big Budget Value:
=
LOOKUPVALUE(
BigBudget[Big Budget Value],
BigBudget[Big Budget], 'Transaction'[Big Budget]
)

I got it I think. You can use the CROSSFILTER measure.
=CALCULATE([Sum of Big Budget Value],CROSSFILTER(BigBudget[Big Budget],'Transaction'[Big Budget],Both))

Related

Modeling Analysis service tabular fact with many columns

I have a tabular analysis service fact table with more than 150 attributes (degenrate) and measures (Invoice fact table).
I would like to improve the user experience when browsing the table on azure AS.
Is it a good idea to split the table horizontally to 3 tables each table contains a set of columns and measures (the number of rows remains the same on 3 tables) ?
I don't change a model for browsing's sake. Browsing is a reporting issue. Modeling is modeling. Build a good dimensional model in a star schema. Big wide tables are bad.
I would look for anything that ought to be a dimension to pull out, and build some junk dimensions, and for sure I would move the measures to a DAX table. But if whatever is left is ugly, then I would just leave it and build a report for browsing.

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 2016 Relationship

Goal
Create a working relationship between my Category Sales and Voids PivotTables so I can leverage one slicer for all data.
Background
Using two PowerQueries, I pull in data from SQL to Excel. Because Sales and Voids have DateStamp and StoreID columns in common, I essentially concatenate these in the SQL query to create an ID. For example:
select concat(StoreID,convert(int,DateStamp)) as ID, DateStamp, StoreID, Category, Sales from...
select concat(StoreID,convert(int,DateStamp)) as ID, DateStamp, StoreID, Voids from...
This is a one-to-many relationship between the two (Sales --> Voids)
Problem
Despite creating the relationship in Excel (through Manage Relationships, as PowerPivot is not available) I can't get it to apply and Excel tells me relationships between tables may be needed. I've no idea what I'm doing wrong.
Workaround
The only workaround I can think of is to take the void value for a given day and divide by the number of categories that have sales, then just do a join to create one table that I pull into Excel. It would technically work for my application, but I'd love to know why the relationship isn't working.
Thanks.
The answer is to export your data into the data model so that you can use power pivot, PLUS a export another power query (or several) into the data model that is a deduplicated table of keys.
Then, in the data model editor, set up the data relationships so that there is a one to many relationship between your deduplicated key table(s) and the "actual data".
Then, in a power pivot, use those "key" tables as much as possible, maybe even to the ruthless ideal(1) of using ONLY key tables in your primary row and column headers, and if you have a second level of categorization then a deduplicated table of primary to secondary, and so on, then using the real data tables only in the body of your power pivot.
(1) - Keep in mind that this is just an ideal I'm just explaining to help you understand and maybe start moving towards as much as actually makes sense. As with most things, in reality, the ideal is almost never worth reaching because there are other factors (like your own patience and time).

Correlation Matrix for monthly return streams in Tableau

Can someone help me create this same thing in Tableau? I am trying to do it for about 20 different stocks. I would appreciate help!
You can read about the CORR() and COVAR() aggregate functions in the Tableau Documentation There are also table calculation versions WINDOW_CORR() and WINDOW_COVAR()
To be effective with them, read about the differences between aggregate calculations and table calcs also. One hint, aggregate calculations are performed by the data source (say Postgres or Oracle), table calculations are performed by the client (say Tableau) taking the aggregate query results as input.

Avoid DISTINCTCOUNT in PowerPivot

Due to performance issues I need to remove a few distinct counts on my DAX. However, I have a particular scenario and I can't figure out how to do it.
As example, let's say one or more restaurants can be hired at one or more feasts and prepare one or more menus (see data below).
I want a PowerPivot table that shows in how many feasts each restaurant was present (see table below). I achieved this by using distinctcount.
Why not precalculating this on Power Query? The real data I have is a bit more complex (more ID columns) and in order to be able to pivot the data I would have to calculate thousands of possible combinations.
I tried adding to my model a Feast dimensional table (on the example this would only be 1 column of 2 rows). I was hoping to use that relationship to be able to make a straight count, but I haven't been able to come up with the right DAX to do so.
You could use COUNTROWS() combined with VALUES().
Specifically, COUNTROWS() will give you the count of rows in a table. That means COUNTROWS is expecting a table is input. Here's the magic part: VALUES() will return a table as results, and the table it returns are the distinct values in the table/column that you provide as the argument for VALUES().
I'm not sure if I'm explaining it well, so for the sample data you provided, the measure would look like this (assuming the table is named Table1):
Unique Feasts:=COUNTROWS(VALUES('Table1'[Feast Id]))
You can then create a pivot table from Powerpivot, and drag Restaurant Id into Rows, and drag the measure above into Values. Same result as DISTINCTCOUNT, but with less performance overhead (I think).

Resources