SSAS 3 fact tables, but only 2 relate to a certain dimension - ssas

I have a cube with 3 fact tables and 20 + dimensions that relate easily to all 3 fact tables and everything works fine except for the fact that one of the dimensions (Warehouse) is only related to 2 of the 3 fact tables. My problem I guess is a display issue. When the user is viewing measures from all 3 fact tables then drags over the Warehouse dimension, it simply repeats the grand total of the measure in the 3rd fact table for every possible value of Warehouse. This certainly makes sense to me as there is no relationship set up and it's conceptually behaving almost like a cross-join. Nonetheless, it's confusing to users and I'd like to not have the grand total duplicated for each dimension member in Warehouse. I was thinking one solution was to create a dummy warehouse called "Not Applicable" and then relate every row in the 3rd fact table to that dimension member. I was hoping there's just a setting in SSAS where I could control this behavior so I didn't have to create any new warehouse values. Is there a standard way to handle non-related dimensions with multiple fact tables? Thanks in advance.

You can use the "IgnoreUnrelatedDimensions" property of the measure group not related to Warehouse: set it from the default value true to false. Then, measure values for this measure group will only be shown for the "All" members from the warehouse dimension, and the cells will be null (empty) for non-All members of this dimension.
This is a global setting per measure group, you cannot configure it individually per dimension and measure group. But for your purpose, this should be fine.

Related

Role Playing dimension among multiple fact tables

I am modelling cube in SSAS. Cube has around 20 dimensions and 6 fact tables. Some of the dimensions are common among the fact tables. e.g. Time dimension. Fact_PNL has 3 date columns for those we have 3 role playing dimensions in the dimension usages.Another fact table has 5 date columns for them as well we have separate role playing dimensions in dimension usage tab. We have a common dimension Company which is foreign key in all fact tables. We might need to combine the data from multiple facts to get final output.
Should i create 6 role playing dimension for each of the fact table or use the same dimension for all fact tables?
Role playing dimensions should be created when we have multiple columns pointing to the same dimension ?
It's up to you. If the role playing dimension plays the same logical role for each fact table, then I would use the same RPD for the same logical role in each fact table. But if you want to use separate ones for each fact table, maybe because you think in the future they might be used differently, then you can.
In short, either way works fine, so whatever makes the most intuitive sense to you and other users is the way you should go.
Yes, that is the purpose of Role Playing Dimensions. When two or more columns in the same fact table reference the same dimension.

Create more than 1 measure from single table column

I am a newbie to SSAS OLAP Cube. I need to create 3 measures from a single table column. Here is the table,
So, I have created 3 tables using Named query in Datasource View. But, it restricts to create 3 measure group for 3 measures. Is there any easy way to do this.
Without knowing how much access you have to create views on the database from which this cube is being created there are a couple of ways to do this.
Option 1 - In the Database
It is good practice to put a view over the tables that you want to build your cube against and point the cube to these views instead of the underlying database tables. If you create a view over this table you can create three columns in your view against the column you have specified above. In your data source view you will then use the view in the database instead of the table and as this view has all three columns they will be available to you to place in one measure group.
This would mean that your view will need to do the WHERE clause filtering and pivoting of the data.
Option 2 - In the Data Source View
If you cannot create a view in the database then you can create all three columns in one named query and thus have one object in the data source view that contains all three columns. This will then allow you to use those columns as measures in the same way that the view in Option 1 would have allowed.
Option 3 - Calculated Measures from three DSV objects
You could keep your solution exactly as it currently is and have three measure groups, each with one measure in them. You then set each of these measure to be Hidden, which will hide the measure groups from users. You then create three calculated measure in SSAS each pointing to one of these measure and set the display folder of all three calculated measures to be the same. When a user then connects to your cube they will see only the calculated measures and they will all appear in the same folder giving the appearance of being in the same measure group.
Option 4 - Calculated Measures using Dimension Filtering
If the value you are filtering on in your where clause in the DSV is brought into the cube in a dimension then you could instead create only one measure from the named query you have created. You can then create three calculated measures and in the MDX of each you will refer to the measure in your measure group and filter based on the Dimension attribute and its member values. You can then place these calculated measures in your measure group and set the original measure to be Hidden.
Option 5 - Filter by the dimension attribute
If you have a dimension with TxType in it you could set the Aggregation function of the measure to Count and then simply drag the TxType attribute from the dimension where it is located onto your reports to filter the measure according to its members.
I hope that helps.

How yo choose the right intermediate measure group in many-many relationship when you have multiple options

I have a fact table called "FactActivity" and a few dimension tables like users, clients, actions, date and tenants.
I create measure groups corresponding to each of them as follows
FactActivity => Sum of ActivityCount colums
DimUser => Count of rows
DimTenant => Count of rows
DimDate => Count of rows and distinct count of weekofyear column
Each user can do multiple actions using multiple clients. A tenant is logical grouping of users. So a tenant contain multiple users but a user can't belong to more than 1 tenant. All the dimension tables and fact tables are connected to DimDate via regular relationship.
The cube structure is as follows.
Now I want to defined the dimension relationships to each of the measure group. Some of them are Many-Many relationsip (to enable distinct count calculation). The designer is showing me multiple options to choose from for many of the intersections. I'm confused as to which one to select as intermediate measure group. Should I always pick the measure group whose total # rows is the least ex: DimDate? Or what is the right logic to determine the intermediate measure group.
This is what I got. IS this right? If no, what is wrong?
For more information to hep choose the right answer.
FactActivity = 1 billion rows
DimUser = 35 million rows
DimTenant = 1 million rows
DimDate = 1000 rows
The correct way to choose the intermediate measure group depends on how you want to evaluate your measures with respect to the dimension related:
Let's start with Activity measure group to Tenant dimension: The question is: How should Analysis Services determine the activity count (or any other measure in the Activity measure group) of a tenant? The only reasonable way to determine this would be to go from the activity fact table through the user table to the tenant table. And actually, the last relationship is not a many-to-many relationship, but a many-to one relationship. I. e. you could optimize away the tenant dimension by integrating it into the user dimension. However, using a many-to-many relationship will work as well, just be a little less efficient. You might also consider using a reference relationship from user to tenant instead of a many-to-many relationship. And there may be other considerations why you may have chosen to have them two separate dimensions, thus I do not discuss this any further.
Now let us continue with the next one: Tenant measure group to User dimension: The way you have configured it (using the date measure group) means that for each date that a tenant and a user have in common, the tenant count of a user adds one to the count. This is probably not what you want. I would assume you want to relate tenant measures to user dimension by the user measure group. However, I am not sure what the purpose of the DateKey in the user and tenant dimension tables is at all. Thus, your relationship may be correct.
Let's continue with the relationships from the Date measure group to the Tenant and User dimensions. I would assume there should be no relationship at all, as the week of the year and the date count do not depend on tenants or users. Please note that it is absolutely ok to have no relationship between some measure groups and some dimensions. If you look at the Microsoft sample cube "Adventure Works", it has more gray cells (i. e. measure group and dimension being unrelated) in the Dimension Usage than white ones (i. e. there is some kind of relationship between measure group and dimension, of whichever type). In the default setting of IgnoreUnrelatedDimensions = true of a measure group, this means that the measure value will be the same for all members of the dimension. This should be the case for date count and week of year. However, again, as I do not know the purpose of the DateKey in the user and tenant dimension tables, I am not sure if this assumption is correct for your data.
And after these examples, I would hope you can continue with the rest of relationships yourself.

dimension hierarchy in SSAS (multiple relationships?)

I have a fact table with columns Product Model and measure Installed base(not important, any other measure would do the same).
Than I have dimension table, and here comes the tricky part:
I have many product models, and each belong to higher level custom_groups (4 in total),
Same product model may belong to more than one custom groupX, and custom groupX may belong to more than one custom groups X-1.
for example hierarchy from highest CG1 to lowest PM Level:
XXX=>YYY=>ZZZ=>WWW
LLL=>MMM=>QQQ=>WWW
RRR=>PPP=>QQQ=>TTT
you can see, that last level PM WWW belongs to 2 different custom groups 3 (QQQ and ZZZ) whereas custom group 3 QQQ may belong to two different custom groups 2 (MMM and PPP in this case).
I tried to model this via hierarchies in SSAS but either I got wrong measure results (IB is summed up without aggregations and results are same for all custom groups), or I get missing some custom groups in my hierarchy.
You can solve this using a many-to-many relationship: Create a dimension table with four columns for the four custom group levels, as well as a custom_group_id column. Fill in to this table all combinations of custom groups that appear in your data. Then build a bridge table (aka factless fact table) with the two columns product_model and custom_group_id. Fill a record into this for each group combination that a product belongs to.
Then, in BIDS create a dimension from the custom group table, and a measure group from your bridge table, using count as the only measure, and make this measure invisible. Finally in the "Dimension Usage" tab of Cube Editor, configure the relationship between the main measure group and the custom group dimension to be many-to-many via the bridge measure group.

Using "Fact" Relationship Type on the "Dimension Usage" tab in a SSAS OLAP cube

I was hoping someone could explain the appropriate use of the 'FACT Relationship Type' under the Dimension Usage tab. Is it simply to create a dimension out of your fact table to access attribute on the fact table itself?
Thanks in advance!
Yes, if your fact table has attributes that you would like to slice by (create a dimension from), you would use this relationship type.
Functionally, to the users it behaves no differently than a regular relationship.
After you create your dimensions and cubes you need to define how each dimension is related to each measure group. A measure group is a set of measures exposed by a single fact table.
Each cube can contain multiple fact tables and multiple dimensions. However, not every dimension will be related to every fact table.
To define relationships right click the cube in BIDS and choose open; then navigate to the Dimension Usage tab. If you click the ellipsis button next to each dimension you will see a screen that allows you to change dimension usage for a particular measure group. You can choose from the following options:
Regular default option; the dimension is joined directly to the fact table
No relationship the dimension is not related to the current measure group
Fact the dimension and fact are derived from a single table. If this is the case your dimensional warehouse has poor design and isn't likely to perform well. Consider separating fact and dimension tables.
Referenced the dimension is joined to an intermediate table prior to being joined to the fact table. Referenced relationship resembles a snowflake dimension, but is slightly different. Suppose you have a customer dimension and a sales fact; you'd like to examine total sales by customer, but you also want to examine line item sales by customer. Instead of duplicating the customer key in the line item fact table you can treat the sales fact as an intermediate table to join customer to line item.
Many-to-many this option involves two fact tables and two dimension tables. Dimension A is joined to an intermediate fact A, which in turn joins to dimension B to which the fact B is joined. Much like with fact option if you need to use many-to-many option your design could probably use some improvement. This type of relationship is sometimes necessary if you are building cubes on top of a relational database that is in 3rd normal form. It is strongly advisable to use a dimensional model with star schema for all cubes. For example you could have two fact tables: vehicles and options; each vehicle can come with a number of options. You're likely to examine vehicle sales by customer, and options by the items that are included in each option. Therefore you would have a customer dimension and item dimension. You could also want to examine vehicles sales by included item. If so the vehicle fact would be joined to the options fact and customer dimension; the options fact would also join to items' dimension.
Data mining target dimension is based on a mining model which is built from a source dimension. Both source dimension and target dimension must be included in the cube.