Teun D
Teun D

Reputation: 5099

How to create a relationship in an SSDT model based on multiple columns?

I am creating a model for Sqlserver Analysis Services (tabular mode) using SSDT. My core measures are in a table with a combined key on UserId and WeekId. I have relations to other tables on UserId and on WeekId. Now I want to add another relation, based on the combination of the two. However, SSDT does not allow me to enter multiple fields when creating a relation.

What should I do? Should I force the measures on a single key? I am a SSAS newby, so maybe I just miss something really obvious.

Upvotes: 0

Views: 1288

Answers (1)

GregGalloway
GregGalloway

Reputation: 11625

You can only use a single column in relationships. You will need to concatenate UserID and WeekID in both tables and then build the relationship.

The alternative is to create a surrogate key integer which is a meaningless identifier that represents the UserID and WeekID combination and add it to both tables.

Upvotes: 1

Related Questions