Hello there and thank for taking your time to read this. This is a very trivial question, however, it is a bit challenging to me. I am trying to add a related dimension in an existing cube and have been unsuccessful so far. I have gone through a few tutorials, but nowhere this concept is covered. I am very new to SSAS, Data Warehousing and SQL server so please bear with my ignorance.
I have documented the steps taken, https://1drv.ms/b/s!AugVuOwqQy9XiFoE2BFR5omxFXAZ?e=Zytp3y
If any additional information, please let me know. Any help is appreciated.
Thank You - KK (filesincloud#outlook.com)
You seem to want to define a Snowflake schema.
You can read about it here
Information from multiple tables is required to define the dimension. Each dimension is based on attributes from columns in multiple tables linked to each other and ultimately to the fact table by primary key - foreign key relationships.
For the Dimension table to Dimension table relationship, you need to use the Referenced Relationship
In simple terms, you need a set a relationship type. The below shows the different relationship types:
If you have the AdventureWorks sample, you can see the following Reference relationship defined:
You can now look at your dimension reference relationship and change it.
Good luck !
Related
This is a question for an assignment. Can somebody please help me?
Criteria
Extensive data dictionary that contains appropriate data items and all relevant details of each data item.
Extensive ER diagram that contains appropriate tables and constraints used. All data items in the data dictionary are reflected in the tables.
Given Data Dictionaries
Finally my question
Should I create an extensive data dictionary when there is already a data dictionary?
Is this correct what I did below?
You'll probably understand that I cannot sovlve your assignment for you: one day you might write mission critical system for the plane or medical device I'll use and I want to be sure that you'll have all the skills needed ;-)
But here some hints to guide you:
The data dictionary provided is not as extensive as it should. So I guess you have to fill the missing cells. For example:
if every employee belongs to a department, do you think that Employee.Department_id is nullable ?
if several employees may belong to the same department department, do you think that Employee.Department_id is unique ?
What with the descriptions and examples?
Your second ERD uses Chen notation. These are excellent to show Entities, Relationships, Attributes. They are not meant to replicate tables. While it seems correct at first sight, some improvements are needed:
the cardinalities between the entities and relationships are definitively missing.
Primary key attributes should be underlined.
Foreign keys are usually not shown, since they are deduced from the relationships and cardinality.
Your first ERD uses Barker's notation. While it also shows entities, relationships and attributes, it is meant to map entities and attributes to tables, and keys. In this regard, it's better in view of your assignment requirement to show all the attributes of the dictionary. Some improvements are required:
Primary keys are well identified. But there are problems with the foreign keys: put a FK only in front of the columns identified as foreign key in data dictionary.
between the entities, you should use the right symbols to reflect the cadinality (simple bar on the side where one item corresponds, crowfoot bars on the side where several items corrspond, and o on the side where there could be no item)
While it is possible to simply show the relationship between entities by connecting them to the table header or the bottom line, in a detailed diagram showing all the field, it is better to graphically connect the boexes at the level of the primary and foreign keys that implement the relationship.
I need to create a bus matrix and in order to do that i need to know which fact table has relationships with which dimension tables.
Unfortunately, in this new project I'm in, it seems to be no FK (crazy, i know).
What I thought about is to use ETL queries and check the joins between the Fact table with the dimension tables.
What I'm worried about is that there might be more relationships that are not included in ETL queries...any advice?
You can use the system metadata tables to list the foreign key references:
select tbname, pkcolnames, reftbname, fkcolnames, colcount
from SYSIBM.SYSRELS B;
If the database does not have properly declared foreign key relationships, then the database does not have the information you are looking for.
Assuming the DB holds no information about the FKs (or information that would help you derive them, like identical column names) then, as you mentioned, examining the ETL code used to load each fact table is probably the only other way of doing this. The ETL must be running a look up on each dimension to get the PK to insert into the fact record, so the information will be there.
There shouldn't be any relationships involving facts that you couldn't determine with this approach. There may be additional relationships between dimensions (bridge tables, more complex SCD types, etc.) but if you sorted out the fact relationships then what remains should be a small enough subset to resolve manually (i.e. by intelligent guesswork)
Hi I am creating a ER diagram for my organization. How can i get the relationship between the tables in snowflake
Thanks
If you are trying to reverse engineer a current Snowflake database, you may have trouble. Foreign key constraints can be included in the table definition, however they are not enforced. If your developers included the constraints when they defined the tables, you can get the relationship from the table definitions. It is a good practice to include the constraints as many third party tools use them.
Do a deep study of all the relations of tables.
And try writing all the conditions on which two or more tables are connected
SELECT
`TABLE_NAME',
`COLUMN_NAME`,
FROM `YOUR_DATABASE`
WHERE 'PUT YOUR CONDITIONS '
This should solve your question
Click Here
I need to create a tabular model with ssas but in a fact table I have two relations with the same dimension (time).
How is it best to handle this?
Duplicating the dimensions table ?
Thanks
You don't need to duplicate the dimension table. You can create both relationships, setting one as INACTIVE. Once this relationship is set up you can invoke the inactive relationship using the USERELATIONSHIP function. This will essentially make the relationship ACTIVE for that measure.
The following links give a great explanation followed by some examples.
Link 1
Link 2
Thanks for your answer,
this model is going to be used by business user and the haven't deep knowledge of dax.
I can't develop all the measures several times (also because it is about 4 dates per table and about fifty measures).
Whant do you think about this:
https://www.biinsight.com/role-playing-dimension-ssas-tabular/#more-1068
Thanks
In my searching, I have seen this error text been asked in different contexts, but specifically, I want to know if I am missing something here.
In a basic setup, I have 1 measure table and 1 dimension table in my DSV. In my test, the measure table has about half of the sold products, but the dimension table has info on the entire product catalog.
The relationship has the measure table as the foreign key and the dimension as the primary. Case is not an issue as both are integers.
What am I doing wrong? I have tried reversing the relationship and I always process the dimension in full before processing the cube in full whenever I make a change.
To avoid the errors, I can set the ignore key errors thing or ensure that the dimension only contains the products that the measure contains. I can do the latter, but I feel that using an unfiltered reference table is cleaner and more efficient - it's on that note that I say "am I missing something?"
Apologies for wasting everyone's time on this one. I was going to delete the question but thought I would share my self-rectified findings:
In my above example, I failed to mention that the dimension table also had links to other tables. Missing (null) references between those tables caused the dimension member to be missing when processed hence the 'attribute key could not be found' when the cube was processed!