How to create/handle complex join conditions in Analysis Services “Tabular” Model between two SCD Type2 tables with 1:M relationship?2019 Community Moderator ElectionHow to create Tabular Project for Analysis Services using REMOTE workspace serverCombine two fact tables from two different marts and model in create Tabular modelDeploying tabular model to Azure Analysis ServicesAnalysis Service Tabular modelHow to fetch data from SCD type2 table for particular yearHow to ignore a relationship in a tabular modelHow To Update Table Relationships in TABULAR SSASSSAS Tabular Model: Difference between calculated table and DAXDAX: How to implement CREATE MEMBER MDX function in SSAS Tabular ModelUnexpected error occured when processing Azure Analysis Services Tabular model
Signed and unsigned numbers
Why do phishing e-mails use faked e-mail addresses instead of the real one?
Why couldn't the separatists legally leave the Republic?
From an axiomatic set theoric approach why can we take uncountable unions?
Professor forcing me to attend a conference, I can't afford even with 50% funding
Vocabulary for giving just numbers, not a full answer
What is Tony Stark injecting into himself in Iron Man 3?
Recommendation letter by significant other if you worked with them professionally?
Confusion about Complex Continued Fraction
Rationale to prefer local variables over instance variables?
How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?
Why aren't there more Gauls like Obelix?
Getting the || sign while using Kurier
When a wind turbine does not produce enough electricity how does the power company compensate for the loss?
What materials can be used to make a humanoid skin warm?
Does Christianity allow for believing on someone else's behalf?
Are all players supposed to be able to see each others' character sheets?
What do you call someone who likes to pick fights?
Can one live in the U.S. and not use a credit card?
Minimizing with differential evolution
Should I take out a loan for a friend to invest on my behalf?
School performs periodic password audits. Is my password compromised?
Is it possible to avoid unpacking when merging Association?
What do *foreign films* mean for an American?
How to create/handle complex join conditions in Analysis Services “Tabular” Model between two SCD Type2 tables with 1:M relationship?
2019 Community Moderator ElectionHow to create Tabular Project for Analysis Services using REMOTE workspace serverCombine two fact tables from two different marts and model in create Tabular modelDeploying tabular model to Azure Analysis ServicesAnalysis Service Tabular modelHow to fetch data from SCD type2 table for particular yearHow to ignore a relationship in a tabular modelHow To Update Table Relationships in TABULAR SSASSSAS Tabular Model: Difference between calculated table and DAXDAX: How to implement CREATE MEMBER MDX function in SSAS Tabular ModelUnexpected error occured when processing Azure Analysis Services Tabular model
I am new to Analysis Services and working on a Tabular model design. Need experts advice/suggestion on the best approach and how to handle below scenarios.
Assuming, I have below two tables Department and Employee where I am storing data for different customers(tenants) and there’s one-to-many (1:M) relationship between these two tables (i.e. one department can have 1 or more employees)
However, let’s say both the tables are SCD Type 2 i.e. storing history with effective and termination dates. There are no constraints, indexes etc. created on these tables at database level.
Department table:
cust_id dept_id dept_name efctv_dt trmntn_dt Dept_key
1001 D1 IT 12-01-2018 12-31-9999 1001D1
1001 D2 HR 01-01-2019 12-31-9999 1001D2
1002 D3 Admin 02-01-2019 02-28-2019 1002D3
1002 D3 HR+Admin 03-01-2019 12-31-9999 1002D3
1002 D4 Finance 02-01-2019 12-31-9999 1002D4
Employee table:
cust_id emp_id emp_name dept_id efctv_dt trmntn_dt Emp_key
1001 E1 XYZ D1 01-01-2019 01-31-2019 1001D1
1001 E1 XYZ-A D1 02-01-2019 12-31-9999 1001D1
1001 E2 ABC D2 02-01-2019 12-31-9999 1001D2
1002 E3 AXBYCZ D3 03-01-2019 03-31-2019 1002D3
1002 E3 AXBYCZ D4 04-01-2019 12-31-9999 1002D4
1002 E4 DEFG D4 04-01-2019 12-31-9999 1002D4
Columns cust_id & dept_id can be concatenated together as a separate column in both the tables as a key field and used as a join between both the tables.
Department Key=Concatenate(department[cust_id], department[dept_id] )
Employee Key=Concatenate(employee[cust_id], employee[dept_id] )
Example key output values= 1001D1, 1001D2, 1002D3, 1002D4
Now let’s say we have following reporting requirements, i.e.
To filter on Date Ranges (in visualization) - assuming there's another date dimension table with all dates & hierarchy
1) When no specific date range or filter selected - show all current active employee & departments names (where, trmntn_dt = 12-31-9999)
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ Finance
2) When reporting for a specific month example - Jan-2019 - show all employees & department names active as of that month.
So, expected output is:
Emp Name Dept Name
XYZ IT
3) When reporting for a specific Quarter example - Q1-2019 - show all employees & department names active as of that quarter.
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ HR+Admin
However, the join condition in AS Tabular model with 1:M relationship between these two tables would fail because the rows are not unique in the Department table (rows for D3), which is on the one side of the relationship.
If you include efctv_dt or trmntn_dt also in the concatenated join condition in both the tables as key for joining i.e.
Department Key=Concatenate(department[cust_id], department[dept_id] ) & Concatenate(department[efctv_dt],””))
Employee Key=Concatenate(employee[cust_id], employee[dept_id] ) & Concatenate(employee[efctv_dt],””))
Example key output values= 1001D112-01-2018, 1001D201-01-2019…
However, though now the rows would be unique since we don’t expect same row twice on the same day (unless some ETL issues like process ran twice on the same day etc.)
AS tabular model doesn’t allow to create complex join/condition (like in SAP BO Universe) so that we could add below condition when joining these two SCD type 2 tables as below which might help solve some of the requirements.
dept.cust_id = emp.cust_id
And dept.dept_id = emp.dept_id
And ( calendar_date is between efctv_dt and trmntn_dt
Or
trmntn_dt = ’12-31-9999’
)
I think for creating/calculating any measure value is still doable with lots of examples available online on DAX, but what about with just the dimensional attributes ?
Is this the right approach ? How to handle these?
ssas reporting dax ssas-tabular scd2
add a comment |
I am new to Analysis Services and working on a Tabular model design. Need experts advice/suggestion on the best approach and how to handle below scenarios.
Assuming, I have below two tables Department and Employee where I am storing data for different customers(tenants) and there’s one-to-many (1:M) relationship between these two tables (i.e. one department can have 1 or more employees)
However, let’s say both the tables are SCD Type 2 i.e. storing history with effective and termination dates. There are no constraints, indexes etc. created on these tables at database level.
Department table:
cust_id dept_id dept_name efctv_dt trmntn_dt Dept_key
1001 D1 IT 12-01-2018 12-31-9999 1001D1
1001 D2 HR 01-01-2019 12-31-9999 1001D2
1002 D3 Admin 02-01-2019 02-28-2019 1002D3
1002 D3 HR+Admin 03-01-2019 12-31-9999 1002D3
1002 D4 Finance 02-01-2019 12-31-9999 1002D4
Employee table:
cust_id emp_id emp_name dept_id efctv_dt trmntn_dt Emp_key
1001 E1 XYZ D1 01-01-2019 01-31-2019 1001D1
1001 E1 XYZ-A D1 02-01-2019 12-31-9999 1001D1
1001 E2 ABC D2 02-01-2019 12-31-9999 1001D2
1002 E3 AXBYCZ D3 03-01-2019 03-31-2019 1002D3
1002 E3 AXBYCZ D4 04-01-2019 12-31-9999 1002D4
1002 E4 DEFG D4 04-01-2019 12-31-9999 1002D4
Columns cust_id & dept_id can be concatenated together as a separate column in both the tables as a key field and used as a join between both the tables.
Department Key=Concatenate(department[cust_id], department[dept_id] )
Employee Key=Concatenate(employee[cust_id], employee[dept_id] )
Example key output values= 1001D1, 1001D2, 1002D3, 1002D4
Now let’s say we have following reporting requirements, i.e.
To filter on Date Ranges (in visualization) - assuming there's another date dimension table with all dates & hierarchy
1) When no specific date range or filter selected - show all current active employee & departments names (where, trmntn_dt = 12-31-9999)
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ Finance
2) When reporting for a specific month example - Jan-2019 - show all employees & department names active as of that month.
So, expected output is:
Emp Name Dept Name
XYZ IT
3) When reporting for a specific Quarter example - Q1-2019 - show all employees & department names active as of that quarter.
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ HR+Admin
However, the join condition in AS Tabular model with 1:M relationship between these two tables would fail because the rows are not unique in the Department table (rows for D3), which is on the one side of the relationship.
If you include efctv_dt or trmntn_dt also in the concatenated join condition in both the tables as key for joining i.e.
Department Key=Concatenate(department[cust_id], department[dept_id] ) & Concatenate(department[efctv_dt],””))
Employee Key=Concatenate(employee[cust_id], employee[dept_id] ) & Concatenate(employee[efctv_dt],””))
Example key output values= 1001D112-01-2018, 1001D201-01-2019…
However, though now the rows would be unique since we don’t expect same row twice on the same day (unless some ETL issues like process ran twice on the same day etc.)
AS tabular model doesn’t allow to create complex join/condition (like in SAP BO Universe) so that we could add below condition when joining these two SCD type 2 tables as below which might help solve some of the requirements.
dept.cust_id = emp.cust_id
And dept.dept_id = emp.dept_id
And ( calendar_date is between efctv_dt and trmntn_dt
Or
trmntn_dt = ’12-31-9999’
)
I think for creating/calculating any measure value is still doable with lots of examples available online on DAX, but what about with just the dimensional attributes ?
Is this the right approach ? How to handle these?
ssas reporting dax ssas-tabular scd2
Why does your Department table contain Customer ID? I think this table is incorrectly designed, and that's the source of your problems (you need to think carefully about the true grain of this table).
– RADO
yesterday
Hi RADO, that Customer ID is actually a Tenant ID and it should not to be confused with Employee ID . Assuming, the fact that you are building a SaaS application (for ex. HRMS system) which supports one of the multi-tenant data strategy i.e. using same database instance, schema and table for storing data for multiple/different clients/customers. For now, please forget about Customer ID field from these tables and let me know if this helps ?
– ManiK
16 hours ago
add a comment |
I am new to Analysis Services and working on a Tabular model design. Need experts advice/suggestion on the best approach and how to handle below scenarios.
Assuming, I have below two tables Department and Employee where I am storing data for different customers(tenants) and there’s one-to-many (1:M) relationship between these two tables (i.e. one department can have 1 or more employees)
However, let’s say both the tables are SCD Type 2 i.e. storing history with effective and termination dates. There are no constraints, indexes etc. created on these tables at database level.
Department table:
cust_id dept_id dept_name efctv_dt trmntn_dt Dept_key
1001 D1 IT 12-01-2018 12-31-9999 1001D1
1001 D2 HR 01-01-2019 12-31-9999 1001D2
1002 D3 Admin 02-01-2019 02-28-2019 1002D3
1002 D3 HR+Admin 03-01-2019 12-31-9999 1002D3
1002 D4 Finance 02-01-2019 12-31-9999 1002D4
Employee table:
cust_id emp_id emp_name dept_id efctv_dt trmntn_dt Emp_key
1001 E1 XYZ D1 01-01-2019 01-31-2019 1001D1
1001 E1 XYZ-A D1 02-01-2019 12-31-9999 1001D1
1001 E2 ABC D2 02-01-2019 12-31-9999 1001D2
1002 E3 AXBYCZ D3 03-01-2019 03-31-2019 1002D3
1002 E3 AXBYCZ D4 04-01-2019 12-31-9999 1002D4
1002 E4 DEFG D4 04-01-2019 12-31-9999 1002D4
Columns cust_id & dept_id can be concatenated together as a separate column in both the tables as a key field and used as a join between both the tables.
Department Key=Concatenate(department[cust_id], department[dept_id] )
Employee Key=Concatenate(employee[cust_id], employee[dept_id] )
Example key output values= 1001D1, 1001D2, 1002D3, 1002D4
Now let’s say we have following reporting requirements, i.e.
To filter on Date Ranges (in visualization) - assuming there's another date dimension table with all dates & hierarchy
1) When no specific date range or filter selected - show all current active employee & departments names (where, trmntn_dt = 12-31-9999)
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ Finance
2) When reporting for a specific month example - Jan-2019 - show all employees & department names active as of that month.
So, expected output is:
Emp Name Dept Name
XYZ IT
3) When reporting for a specific Quarter example - Q1-2019 - show all employees & department names active as of that quarter.
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ HR+Admin
However, the join condition in AS Tabular model with 1:M relationship between these two tables would fail because the rows are not unique in the Department table (rows for D3), which is on the one side of the relationship.
If you include efctv_dt or trmntn_dt also in the concatenated join condition in both the tables as key for joining i.e.
Department Key=Concatenate(department[cust_id], department[dept_id] ) & Concatenate(department[efctv_dt],””))
Employee Key=Concatenate(employee[cust_id], employee[dept_id] ) & Concatenate(employee[efctv_dt],””))
Example key output values= 1001D112-01-2018, 1001D201-01-2019…
However, though now the rows would be unique since we don’t expect same row twice on the same day (unless some ETL issues like process ran twice on the same day etc.)
AS tabular model doesn’t allow to create complex join/condition (like in SAP BO Universe) so that we could add below condition when joining these two SCD type 2 tables as below which might help solve some of the requirements.
dept.cust_id = emp.cust_id
And dept.dept_id = emp.dept_id
And ( calendar_date is between efctv_dt and trmntn_dt
Or
trmntn_dt = ’12-31-9999’
)
I think for creating/calculating any measure value is still doable with lots of examples available online on DAX, but what about with just the dimensional attributes ?
Is this the right approach ? How to handle these?
ssas reporting dax ssas-tabular scd2
I am new to Analysis Services and working on a Tabular model design. Need experts advice/suggestion on the best approach and how to handle below scenarios.
Assuming, I have below two tables Department and Employee where I am storing data for different customers(tenants) and there’s one-to-many (1:M) relationship between these two tables (i.e. one department can have 1 or more employees)
However, let’s say both the tables are SCD Type 2 i.e. storing history with effective and termination dates. There are no constraints, indexes etc. created on these tables at database level.
Department table:
cust_id dept_id dept_name efctv_dt trmntn_dt Dept_key
1001 D1 IT 12-01-2018 12-31-9999 1001D1
1001 D2 HR 01-01-2019 12-31-9999 1001D2
1002 D3 Admin 02-01-2019 02-28-2019 1002D3
1002 D3 HR+Admin 03-01-2019 12-31-9999 1002D3
1002 D4 Finance 02-01-2019 12-31-9999 1002D4
Employee table:
cust_id emp_id emp_name dept_id efctv_dt trmntn_dt Emp_key
1001 E1 XYZ D1 01-01-2019 01-31-2019 1001D1
1001 E1 XYZ-A D1 02-01-2019 12-31-9999 1001D1
1001 E2 ABC D2 02-01-2019 12-31-9999 1001D2
1002 E3 AXBYCZ D3 03-01-2019 03-31-2019 1002D3
1002 E3 AXBYCZ D4 04-01-2019 12-31-9999 1002D4
1002 E4 DEFG D4 04-01-2019 12-31-9999 1002D4
Columns cust_id & dept_id can be concatenated together as a separate column in both the tables as a key field and used as a join between both the tables.
Department Key=Concatenate(department[cust_id], department[dept_id] )
Employee Key=Concatenate(employee[cust_id], employee[dept_id] )
Example key output values= 1001D1, 1001D2, 1002D3, 1002D4
Now let’s say we have following reporting requirements, i.e.
To filter on Date Ranges (in visualization) - assuming there's another date dimension table with all dates & hierarchy
1) When no specific date range or filter selected - show all current active employee & departments names (where, trmntn_dt = 12-31-9999)
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ Finance
2) When reporting for a specific month example - Jan-2019 - show all employees & department names active as of that month.
So, expected output is:
Emp Name Dept Name
XYZ IT
3) When reporting for a specific Quarter example - Q1-2019 - show all employees & department names active as of that quarter.
So, expected output is:
Emp Name Dept Name
XYZ-A IT
ABC HR
AXBYCZ HR+Admin
However, the join condition in AS Tabular model with 1:M relationship between these two tables would fail because the rows are not unique in the Department table (rows for D3), which is on the one side of the relationship.
If you include efctv_dt or trmntn_dt also in the concatenated join condition in both the tables as key for joining i.e.
Department Key=Concatenate(department[cust_id], department[dept_id] ) & Concatenate(department[efctv_dt],””))
Employee Key=Concatenate(employee[cust_id], employee[dept_id] ) & Concatenate(employee[efctv_dt],””))
Example key output values= 1001D112-01-2018, 1001D201-01-2019…
However, though now the rows would be unique since we don’t expect same row twice on the same day (unless some ETL issues like process ran twice on the same day etc.)
AS tabular model doesn’t allow to create complex join/condition (like in SAP BO Universe) so that we could add below condition when joining these two SCD type 2 tables as below which might help solve some of the requirements.
dept.cust_id = emp.cust_id
And dept.dept_id = emp.dept_id
And ( calendar_date is between efctv_dt and trmntn_dt
Or
trmntn_dt = ’12-31-9999’
)
I think for creating/calculating any measure value is still doable with lots of examples available online on DAX, but what about with just the dimensional attributes ?
Is this the right approach ? How to handle these?
ssas reporting dax ssas-tabular scd2
ssas reporting dax ssas-tabular scd2
asked Mar 6 at 14:19
ManiKManiK
132
132
Why does your Department table contain Customer ID? I think this table is incorrectly designed, and that's the source of your problems (you need to think carefully about the true grain of this table).
– RADO
yesterday
Hi RADO, that Customer ID is actually a Tenant ID and it should not to be confused with Employee ID . Assuming, the fact that you are building a SaaS application (for ex. HRMS system) which supports one of the multi-tenant data strategy i.e. using same database instance, schema and table for storing data for multiple/different clients/customers. For now, please forget about Customer ID field from these tables and let me know if this helps ?
– ManiK
16 hours ago
add a comment |
Why does your Department table contain Customer ID? I think this table is incorrectly designed, and that's the source of your problems (you need to think carefully about the true grain of this table).
– RADO
yesterday
Hi RADO, that Customer ID is actually a Tenant ID and it should not to be confused with Employee ID . Assuming, the fact that you are building a SaaS application (for ex. HRMS system) which supports one of the multi-tenant data strategy i.e. using same database instance, schema and table for storing data for multiple/different clients/customers. For now, please forget about Customer ID field from these tables and let me know if this helps ?
– ManiK
16 hours ago
Why does your Department table contain Customer ID? I think this table is incorrectly designed, and that's the source of your problems (you need to think carefully about the true grain of this table).
– RADO
yesterday
Why does your Department table contain Customer ID? I think this table is incorrectly designed, and that's the source of your problems (you need to think carefully about the true grain of this table).
– RADO
yesterday
Hi RADO, that Customer ID is actually a Tenant ID and it should not to be confused with Employee ID . Assuming, the fact that you are building a SaaS application (for ex. HRMS system) which supports one of the multi-tenant data strategy i.e. using same database instance, schema and table for storing data for multiple/different clients/customers. For now, please forget about Customer ID field from these tables and let me know if this helps ?
– ManiK
16 hours ago
Hi RADO, that Customer ID is actually a Tenant ID and it should not to be confused with Employee ID . Assuming, the fact that you are building a SaaS application (for ex. HRMS system) which supports one of the multi-tenant data strategy i.e. using same database instance, schema and table for storing data for multiple/different clients/customers. For now, please forget about Customer ID field from these tables and let me know if this helps ?
– ManiK
16 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025270%2fhow-to-create-handle-complex-join-conditions-in-analysis-services-tabular-mode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025270%2fhow-to-create-handle-complex-join-conditions-in-analysis-services-tabular-mode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why does your Department table contain Customer ID? I think this table is incorrectly designed, and that's the source of your problems (you need to think carefully about the true grain of this table).
– RADO
yesterday
Hi RADO, that Customer ID is actually a Tenant ID and it should not to be confused with Employee ID . Assuming, the fact that you are building a SaaS application (for ex. HRMS system) which supports one of the multi-tenant data strategy i.e. using same database instance, schema and table for storing data for multiple/different clients/customers. For now, please forget about Customer ID field from these tables and let me know if this helps ?
– ManiK
16 hours ago