DAX - Table Relationships Flashcards

1
Q

What is a Fact table?

A

A table that keeps numeric data that might be aggregated in the reporting visualizations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are dimensions in Power BI?

A

A table that keeps descriptive information that can slice and dice the data of the fact table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a role-playing dimension?

A

Instances of the same dimension used multiple times in a data model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why use role-playing dimensions?

A

To analyze data from different viewpoints without duplicating data tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Example of role-playing dimensions

A

A date dimension where order date, shipped date and delivery date each use the same date table. The Date Table is a role-playing dimension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an active relationship?

A

The relationship between two tables that is currently active.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an inactive relationship?

A

A valid relationship not being actively used in the current analysis.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you tell which relationships are active and which are inactive?

A
  • An active relationship is represented by a solid line
  • An inactive relationship is represented by a dotted line
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Example of multiple relationships

A

The three relationships all connect from one field in the Date table to the Order Date, Shipped Date and Delivery Date of the Sales table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

By default, which relationship is made active if there is more than one?

A

The first relationship created is automatically made active. Any subsequent relationships will be made inactive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

USERELATIONSHIP syntax

A

USERELATIONSHIP(
TableName1[ColumnName1],
TableName2[ColumnName2]
)

Note that the column order does not matter. You just need to indicate which columns you want to join.

This function does not return a value, it simply alters the filter context of a calculation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does USERELATIONSHIP work?

A
  • Forces the inactive relationship you specify to be used instead of the currently active relationship.
  • It can be used multiple times within a single calculate function to switch multple relationships.
  • Must exist in the data model
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Where is the USERELATIONSHIP function used?

A

Within the CALCULATE function. If you try to use it anywhere else you will get an error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Example of USERELATIONSHIP

A

Total Sales (Shipping Date) =
CALCULATE (
SUM(Sales[Sa1es Amount]), //Expression
USERELATIONSHIP( //Filter
Sales[Shipping Date], //Table1
Date[Date]) //Table2
)

  1. The CALCULATE function is used to alter the filter context of the entire measure.
  2. Then a temporary relationship based on the shipping date column is made active by using USERELATIONSHIP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an advantage of using USERELATIONSHIP?

A

It enables you to perform analysis using different relationships available between the related tables without affecting the overall structure of the data model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly