SSAS - Cannot create relationships due to dupicate column entries - ssas

I am currently building a tabular cube in SSAS, however I'm having issues when creating relationships.
I have 3 tables
Master
Supplier
Customer
In the master table I have a list of unique IDs, these ID's appear in the other 2 tables (there can be duplicate records for the ID in the Supplier and Customer table).
What I'm tring to do is create a relationship between the Master table and the Supplier and Customer table. One to Many. But SSAS gives me an error The relationship cannot be created because each column contains duplicate values. Select at least one column that contains only unique values.
Any advise would be greatly appreciated

Based on the error message it seems to be there are some duplicate values in the master table within the column that is being selected for relationship.

Related

rearrange two columns into single unique rows

I have a table that has two ID fields:
ID_expired
ID_issued
This table is the only place where this link between IDs is recorded. An ID_issued will show up with a match in these ID_expired column when a new ID_issued occurs (e.g. z234, g123). There are some exact duplicate rows. There are also instances where there is a duplicate ID_issued but no ID_expired listed (e.g. b111).
My objective is to connect all the IDs into a single row so I can refer to the ID history of an individual.
You can create a View and add the table to the view for as many times as there are ID's and join it on itself as many times as well.

Cannot create multiple relationship to same master table

I am very new to SSAS tabular model and I have a very basic problem which I am facing.
I have a master table "city", wherein I have city_code and city_name column. city_code is the primary key.
I have another table sales, wherein I have two columns (pos_city, shipped_to_city) out of many other columns.
Now, I have to create a many to one relationship from sales tables to city table , from both these columns to master tables..
i.e.
pos_city(sales) --> city_code(city)
shipped_to_city(sales) --> city_code(city)
However, when i try to do this for the second relationship, I get an error message saying 'active relationship between sales and city already exists'.
Can anyone suggest how can i get around this problem?
In tabular you can only have one physical relationship between two tables active at a time.
It depends on how the end user wants to interact with the data but one option is to duplicate your master table. Name one table DimCityOfSale and the other DimCityShippedTo. Then create a physical relationship between the tables
DimCityofSale[citycode] -> Sales[pos_city]
and
DimCityShippedTo[citycode] -> Sales[shipped_to_city]

develop oracle sql to build dimension

I have three tables in 3rd Normalized form and these tables are populated by java application.
MA_COMPANY_PROFILE (table 1)
MA_ACCOUNT (table 2)
SEC_USER (table 3)
Hierarchy is from MA_COMPANY_PROFILE, MA_ACCOUNT, SEC_USER.
relationship between MA_COMPANY_PROFILE and MA_ACCOUT is 1:n
relationship between MA_COMPANY_PROFILE and SEC_USER is n:n
relationship between MA_ACCOUNT and SEC_USER is n:1
When we use below sql in informatica to load this data in denormalized format,
select *
from
MA_COMPANY_PROFILE MA_CMY_PRF,
MA_ACCOUNT MA_AC,
ACCOUNT_STATUS AC_ST,
SEC_USER SEC_USR,
SEC_USERS_LASTLOGIN SEC_USR_LL
where
MA_CMY_PRF.PROFILE_ID=MA_AC.PROFILE_ID(+) and
MA_CMY_PRF.PROFILE_ID =SEC_USR.PROFILE_ID(+)
we get different number of accounts in source table and warehouse table
or when we try to match number of security users in source and warehouse.
how do we approach this or prepare oracle sql to develop correctly to match source accounts and users and warehouse tables?
If we're talking just about the 3 tables concerned and ignore the 2 tables which dont have conditions... you should be flowing from one table to the inter table and from the inter table to the final table, so the final condition would look like
MA_CMY_PRF.PROFILE_ID=MA_AC.PROFILE_ID AND MA_AC.USER_ID = SEC_USR.USER_ID
This assumes that PROFILE_ID is the primary key of MA_COMPANY_PROFILE, USER_ID is the primary key for SEC_USER and that there are foreign keys to both on the MA_ACCOUNT table. Also you've used (+) presumably to ensure that, where no match is found, you always have a record populated with just the info from MA_CMY_PRF and nulls from the related tables, I've left this off as I don't know your requirement.
I found the reason why the source table count and my target count are mismatch for profile_id, account_id, user_id. Since source tables are having null value in my join column ie profile_id.

Power Pivot relationships

Trying to create relationships (joins) between tables in power pivot.
Got 2 tables I wold like to join together, connected with a common column = CustomerID.
One is a Fact Table the other Dim table (look up).
I have run the "remove duplicates" on both tables without any problem.
But I still get an error saying : "the relationship cannot be created because each column contains duplicate values. Select at least one column that contains only unique values".
The Fact Table contains duplicates (as it should?) and the Dim Table do not, why do I get this error?
Help much appreciated
Created an appended table with both columns "CustomerID". After the columns where appended together I could "remove duplicates" and connect the tables together through the newly created appended table.
Don't know if this causes another problem later however.
You can also check for duplicate id values in a column by using the group by feature.
Remove all columns except ID, add a column that consists only of the number 1.
Group by ID, summing the content of the added column and filter out IDs whose total equals 1. What's left are duplicated IDs.

fact table should have measures from 'weak entity' or only parent entity's fields should be entered

i am new to dimension modeling and OLAP.
I am trying to create a dimension model for a shop.
"order" table is having columns:
'order_id(auto generated), total_order_cost, date, product_Set_Id'.
"Product_set" table (contains products ordered in each order i.e. multiple rows for each order, tables logically linked by 'product_set_id' column) has columns:
'product_set_id, product_name, quantity,Cost_per_quantity'.
In the ER model "product_set" table is kind of weak entity dependent on "order" table.
My doubt is in the fact table
case 1: i should add only 'order_id(fk)' and 'total_order_cost(as measure)'
==>in this case measures from "product_set" won't be there in fact table.
or case 2:i should add 'order_id(fk)','product_set_id(fk)' and 'cost_per_quantity(measure), quantity(measure), total_order_cost(measure)'
==>in this case there will be multiple rows for same 'order_id' and 'total_order_cost'
There are other some tables like "customer" etc but i have doubt in above mentioned.
Thanks in advance!
one suggestion always made is to create a surrogate key on the tables. My fact sales is such that it has the surrogate key which allows me to have the orderline data there and each orderline identified by a surrogate key (which I don't really use - but its not an issue) . That way you can follow case 2.
Does that answer the question?