Write DAX formulas for Power BI Desktop models Flashcards

1
Q

What types of calculations can you add to your semantic model using DAX in Power BI?

A

Calculated tables, calculated columns, and measures.

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

What is a calculated table in Power BI?

A

A table created using a DAX formula to duplicate, transform, or generate new data, which is imported into the model and increases storage size.

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

What is the primary function of a calculated column in Power BI?

A

To add a column to any table with a DAX formula that evaluates for each row, increasing storage size and evaluated at data refresh for Import mode tables or at query time for DirectQuery tables.

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

How are measures different from calculated columns in Power BI?

A

Measures are concerned with summarization, evaluated at query time, and their results are not stored in the model. They are identified with a calculator icon in the Fields pane.

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

What is a role-playing dimension in Power BI?

A

A dimension table that plays multiple roles in a model, such as a Date table relating to multiple date columns in another table, using active and inactive relationships.

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

What is the purpose of What-if parameters in Power BI?

A

To allow users to select or filter by values in a calculated table, enabling hypothetical analysis without the calculated table propagating filters.

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

What is the general structure for creating a model calculation in DAX?

A

<Calculation> = <DAX>
</DAX></Calculation>

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

What are the main elements used to assemble DAX formulas?

A

DAX functions, DAX operators, references to model objects, constant values, DAX variables, and whitespace.

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

What is IntelliSense in Power BI Desktop?

A

A code-completion aid that lists functions and model resources, helping quickly build accurate formulas.

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

What must follow function names in DAX formulas?

A

Parentheses, where variables are passed in.

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

How should column references be formatted in DAX formulas?

A

Enclosed within square brackets and optionally preceded by the table name for clarity.

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

How should measure references be formatted in DAX formulas?

A

Enclosed within square brackets, and it’s recommended not to precede them with the table name.

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

What role does whitespace play in DAX formulas?

A

It helps format the formulas for readability and troubleshooting, without affecting logic or performance.

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

How can you format a measure for better readability in DAX?

A

By using spaces, tabs, and carriage returns to structure the formula clearly.

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

What are the model data types in Power BI?

A

Whole number, decimal number, boolean, text, date, currency, and BLANK.

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

How are calculated column data types determined in Power BI?

A

They are inferred from the formula used.

17
Q

What is the range of values for a whole number in DAX?

A

-2^63 through 2^63-1.

18
Q

How does DAX handle database NULL values?

A

With the BLANK data type, which represents the absence of a value.

19
Q

What functions are related to the BLANK data type in DAX?

A

The BLANK() function returns BLANK, and the ISBLANK() function tests for BLANK.

20
Q

What is the IF function in DAX used for?

A

To test a condition and return one value if TRUE and another if FALSE.

21
Q

Name a few summarization functions available in both Excel and DAX.

A

SUM, COUNT, AVERAGE, MIN, MAX.

22
Q

What does the DISTINCTCOUNT function do in DAX?

A

Counts the number of distinct values in a column.

23
Q

Why should you use the DIVIDE function in DAX?

A

It handles division by zero cases and is optimized for performance.

24
Q

What is a recommended practice when dealing with potential zero or BLANK denominators in DAX?

A

Use the DIVIDE function for better performance and handling.

25
Q

What happens when you use arithmetic operators on BLANK values in DAX?

A

BLANK is treated as zero for arithmetic operations and as an empty string for concatenation.

26
Q

What is the purpose of using DAX variables in Power BI?

A

To improve readability, maintainability, and performance of formulas by evaluating variables only once and simplifying testing of complex formulas.

27
Q

How do you declare a variable in a DAX formula?

A

Use the VAR keyword followed by the variable name and its expression, then refer to it in the RETURN clause.