MSBA-269 · Lesson 4 of 12 · 21 min
Domain review: modeling data
▶ Video coming soon A video version of this lesson is on the way.
For the fourth session, Rupert asked Kwabena to bring the Student Success model up on screen and talk through it as if he were explaining it to an examiner. Kwabena started with the Registration fact table, then the Student, Program, Course, Campus and Date dimensions, the Access table behind row-level security, and the measures folder. Rupert interrupted every few minutes with a question: "Why is that relationship single direction?" "Why is Date marked as a date table?" "Why is Term Start Date a second, inactive relationship?" By the end, Kwabena had answered most of the domain 2 objectives out loud without opening the study guide.
Domain 2, modeling the data, is worth 25 to 30 percent of PL-300. It has three objective groups: designing and implementing a data model, creating model calculations with DAX, and optimizing model performance. This lesson reviews the first and third groups and the DAX objectives at the level of "which calculation fits". Lesson 7 is devoted to reading and completing DAX expressions, which is the skill DAX questions actually test. The material was taught in Modeling Data and Writing DAX (MSBA-261).
Design and implement a data model
The first objective is to configure table and column properties. In the Model view, the Properties pane controls names, descriptions, display folders, data category (such as City or Web URL), summarization (Do not summarize for a key or year column), sort by column, and whether a field is hidden. Exam questions often describe a symptom that a property fixes: a Month name column sorts alphabetically, so set Sort by column to the month number; a Year column is being summed in visuals, so set its default summarization to Do not summarize; a map plots towns in the wrong country, so set the data category and include the region.
The second objective is to implement role-playing dimensions. A role-playing dimension is one table used in several roles, such as a Date table related to both Registration Date and Term Start Date. Only one relationship between two tables can be active. The exam tests two solutions: create an inactive relationship and activate it in a measure with USERELATIONSHIP, or create a separate copy of the dimension for each role. Which is right depends on the constraint. If report users must be able to slice by both dates at the same time, separate dimension tables are needed. If a few measures need the second date, an inactive relationship with USERELATIONSHIP is simpler.
The third objective is to define a relationship's cardinality and cross-filter direction. Most relationships in a star are one-to-many, from the dimension (one) to the fact (many), with single cross-filter direction so that dimensions filter facts. Many-to-many relationships appear with bridge tables or when keys repeat on both sides. Both directions can solve a specific problem, such as filtering a dimension by what exists in a fact table, but it can create ambiguity and slow performance. The exam's preferred answer is usually to keep single direction and handle special cases with measures, unless the question requires the dimension to be filtered in the visual itself.
| Cardinality | Where it appears | Exam signal |
|---|---|---|
| One-to-many | Dimension to fact, the normal star | Default answer for dimension and fact tables |
| One-to-one | Two tables with the same unique key | Often a sign the tables should be merged |
| Many-to-many | Keys repeat on both sides, or budgets at a higher grain than actuals | Consider a bridge table or relate at the common grain |
The fourth objective is to create a common date table. A date table needs one row per date with no gaps, covering the full range of dates in the model, and is marked as a date table so that time intelligence functions behave correctly. It can be created in Power Query, from a source, or with DAX functions such as CALENDAR or CALENDARAUTO. Questions test the requirements for marking (a unique, contiguous date column) and the effect of leaving Auto date/time on, which creates hidden date tables for every date column and enlarges the model.
The last objective in the group is to identify use cases for calculated columns and calculated tables. A calculated column is computed row by row at refresh and stored, so it can be used in slicers, rows of a matrix and relationships. A measure is computed at query time in the filter context of the visual and is not stored. The exam's rule of thumb: if you need to slice or group by the value, use a column; if you need an aggregate that responds to filters, use a measure. Calculated tables suit role-playing copies, small helper tables and date tables built in DAX.
Create model calculations by using DAX
The DAX objectives list the kinds of calculation an analyst is expected to write. Single aggregation measures such as SUM, COUNTROWS and DISTINCTCOUNT. The CALCULATE function, which changes filter context. Time intelligence measures such as year-to-date and same period last year. Basic statistical functions such as AVERAGE, MEDIAN, MIN, MAX and STDEV. Semi-additive measures, for balances that must not be summed over time. Quick measures. Calculated tables or columns. And calculation groups, which apply the same transformation, such as year-to-date, to many measures without writing each version separately.
| Requirement | Calculation type | Typical functions |
|---|---|---|
| Total registrations in the current filter | Single aggregation measure | COUNTROWS, SUM |
| Registrations for one campus regardless of the slicer | CALCULATE with a filter | CALCULATE, REMOVEFILTERS |
| Year-to-date credits | Time intelligence | TOTALYTD or CALCULATE with DATESYTD |
| Median credits per student | Statistical | MEDIANX or MEDIAN |
| Enrolled headcount at term census date, not summed over weeks | Semi-additive | LASTDATE or LASTNONBLANK inside CALCULATE |
| Year-to-date and prior-year versions of ten measures | Calculation group | Calculation items with SELECTEDMEASURE |
Quick measures deserve a mention because they are easy points. A quick measure generates DAX from a dialog for common patterns such as running totals and averages per category. The exam may ask which feature lets an analyst create a year-to-date total without writing DAX, and the answer is a quick measure. Microsoft has added Copilot assistance to writing measures in some experiences, but the outline names quick measures, so that is the term to expect.
Optimize model performance
The third group has three objectives. Remove unnecessary rows and columns: every column imported costs memory, and high-cardinality columns such as timestamps and free-text comments cost the most. Identify poorly performing measures, relationships and visuals by using Performance Analyzer and DAX query view: Performance Analyzer records how long each visual takes, split into DAX query time, visual display time and other; copying the query into DAX query view lets you test and tune it. Reduce granularity: storing daily totals instead of every transaction, or splitting a date/time column into a date column and a time column, reduces cardinality and model size.
Worked problem
Diagnosing a slow page
The Program detail page takes eight seconds to load. Performance Analyzer shows the matrix spends most of its time in DAX query, while other visuals are quick. The matrix uses a measure that iterates over every registration row with FILTER on a text column. The model also imports a RegistrationTimestamp column with millions of distinct values that no report uses. Which two changes are most likely to help, according to the domain 2 objectives?
Show solution
- Long DAX query time on one visual points to the measure, not the visual display.
- Copy the query into DAX query view and rewrite the measure to filter on a column in a dimension with CALCULATE instead of iterating every fact row.
- Remove the unused high-cardinality timestamp column, or split it into date and time if it is needed.
- Rerun Performance Analyzer to confirm.
Answer: Tune the measure using DAX query view and remove or reduce the granularity of the unused timestamp column. These match the objectives "identify poorly performing measures" and "remove unnecessary rows and columns" or "reduce granularity".
Patterns in domain 2 questions
Domain 2 questions are often built around a model diagram. Read the diagram the way Rupert read Kwabena's model: count the fact tables, check the arrow directions, look for dashed lines (inactive relationships) and note many-to-many markers. Then read the requirement. Many questions are answerable from the diagram alone once you know which property or relationship setting the requirement depends on.
| Phrase in the question | Usually points to |
|---|---|
| "Month names sort alphabetically" | Sort by column |
| "Filter by order date and ship date in the same report" | Separate role-playing dimension tables |
| "A few measures need the ship date" | Inactive relationship and USERELATIONSHIP |
| "Time intelligence returns blank" | Mark as date table; contiguous dates |
| "Account balance must not add up across months" | Semi-additive measure |
| "Same year-to-date logic for many measures" | Calculation group |
| "Find the slow visual" | Performance Analyzer |
Relationship scenarios to rehearse
Relationship questions are a reliable source of marks in domain 2 because they test reasoning rather than recall. Most can be answered by asking three questions about each relationship: which side has unique values, which way should filters flow, and is there more than one path between the same two tables. Kwabena drew a quick sketch of the tables on his scratch material for every relationship question in his practice sets, and his accuracy on them rose noticeably within a week.
| Situation in the question | Usual answer | Why |
|---|---|---|
| A Budget table at month and category grain must be compared with daily Sales | Relate Budget to dimension tables at matching grain, such as a month-level column or a bridge, rather than directly to Sales | Facts at different grains are joined through shared dimensions |
| Students can belong to many groups, and groups have many students | A bridge table between Student and Group, with one-to-many relationships to it | A bridge keeps filtering predictable; a direct many-to-many relationship is a last resort |
| A slicer on a dimension must filter another dimension through the fact | Consider a measure-based filter or a carefully chosen both-direction relationship | Both-direction filtering can create ambiguity and slow queries |
| Two dates in one fact table, used separately | One active relationship and one inactive, with USERELATIONSHIP | Only one active path is allowed |
| Two dates in one fact table, sliced at the same time | A second date table, so each date has its own active relationship | Role-playing dimensions as separate tables allow both at once |
| A lookup table has duplicate keys | Remove duplicates in Power Query before creating the relationship | The one side of a relationship needs unique values |
Model size and data types
Questions on model size reward knowing how the VertiPaq engine stores data. Columns compress best when they have few distinct values. A datetime column with seconds can have millions of distinct values; splitting it into a date column and, if needed, a time column rounded to the minute or hour can shrink it dramatically. Whole numbers compress better than text. Columns that nobody uses in visuals, filters, relationships or measures should be removed, because each one costs memory and refresh time.
| Change | Effect on size | Trade-off |
|---|---|---|
| Remove unused columns | Often the largest single saving | None, if the column is truly unused |
| Split datetime into date and time | Fewer distinct values per column | A little Power Query work |
| Reduce precision, such as rounding time to the hour | Fewer distinct values | Less detail |
| Summarize rows to a coarser grain | Fewer rows | Detail queries need DirectQuery or another source |
| Replace calculated columns with measures where possible | No stored column | Measures are evaluated at query time |
| Turn off Auto date/time | Removes hidden date tables for every date column | Use a marked date table instead |
Worked problem
A size question
The Student Success model has grown, and refresh now takes too long. The Registration table has a RegisteredAt datetime column with seconds, a free-text Notes column used by no report, and a calculated column that concatenates first and last name for a single table visual. Which changes reduce size with the least loss of function?
Show solution
- Notes is unused: remove it.
- RegisteredAt is used only by date in reports: keep a date column and drop the time, or round the time to the hour if a report needs it.
- The name column could move to the Student dimension, where it is stored once per student instead of once per registration.
Answer: Remove Notes, reduce RegisteredAt to a date (and an hour column only if needed), and move the full-name column to the Student dimension. Each change keeps every report working.
Common mistakes
MistakeSetting every relationship to Both to "make filters work".
InsteadKeep single direction from dimension to fact and solve special cases with measures or a specific requirement.
MistakeUsing a calculated column where a measure is needed.
InsteadUse a measure for aggregates that respond to filters; use a column when you need to slice or group by the value.
MistakeLeaving Auto date/time on with a proper date table.
InsteadTurn it off and mark your date table, which reduces model size and avoids confusion.
MistakeTreating long visual display time as a measure problem.
InsteadDisplay time points to the visual; DAX query time points to the measure or model.
Summary and key terms
- Domain 2, modeling the data, is 25 to 30 percent: design the model, write DAX calculations, optimize performance.
- Table and column properties fix sorting, summarization and data category symptoms.
- Role-playing dimensions use inactive relationships with USERELATIONSHIP or separate tables, depending on whether users slice by both roles.
- Know the calculation types named in the outline, including semi-additive measures, quick measures and calculation groups.
- Performance Analyzer and DAX query view diagnose slow visuals; removing columns and reducing granularity shrink the model.
- Role-playing dimension
- One dimension related to a fact table in several roles, such as two dates.
- Cross-filter direction
- Whether a relationship filters one way or both ways.
- Date table
- A table with one row per date, marked so time intelligence functions work.
- Semi-additive measure
- A measure that sums across some dimensions but not across time, such as a balance.
- Calculation group
- A model object that applies the same logic to many measures through calculation items.
- Performance Analyzer
- A Desktop pane that times each visual's query and rendering.
Practice problems
Work each problem on paper first, then reveal the answer to check.
A Month column sorts April, August, December. What fixes it?
Show answer
Set Sort by column to a month number column.
Report users must slice by both enrollment date and graduation date at the same time. What model design is needed?
Show answer
Separate date dimension tables for each role, each with an active relationship.
What does long DAX query time in Performance Analyzer suggest?
Show answer
The measure or model is the bottleneck; tune the DAX or the model.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.