Field Guide · 05

Semantic model preparation

The semantic model is where structure becomes a user interface. Star in, star out: gold hands over a clean star, and the model adds relationships, measures, names and security without reshaping the data.

Star in, star out

Each model table should map to one gold table, with friendly names applied at the model boundary. For the "Sales & Inventory" model:

Model tableGold sourceRole
Datedim_dateMarked date table; plays order and ship date
Customerdim_customerType 2; as-was region plus current region
Productdim_productType 1; category drives Budget
Warehousedim_warehouseShared by Sales and Inventory
Salespersondim_salespersonAlso the natural RLS anchor
Salesfact_salesOrder line grain; all columns hidden
Inventoryfact_inventory_dailyDaily snapshot; semi-additive
Budgetfact_budgetMonth x category x region
MeasuresnoneHome for every measure

If the model needs a Power Query step, a calculated column or a calculated table to make the star work, that is a sign the fix belongs upstream. In Direct Lake it is not even an option: Direct Lake tables have no Power Query, and calculated columns on them are not supported (check current documentation, as Direct Lake capabilities have been expanding).

Relationships and cardinality

The default is one-to-many, single direction, with the dimension filtering the fact. Departures from the default should each have a stated reason.

From (one)To (many)CardinalityDirectionActive
Date[Date Key]Sales[Order Date Key]1 : *SingleYes
Date[Date Key]Sales[Ship Date Key]1 : *SingleNo
Customer[Customer Key]Sales[Customer Key]1 : *SingleYes
Product[Product Key]Sales, Inventory1 : *SingleYes
Warehouse[Warehouse Key]Sales, Inventory1 : *SingleYes
Salesperson[Salesperson Key]Sales[Salesperson Key]1 : *SingleYes
Date[Date Key]Inventory[Date Key]1 : *SingleYes
Product[Category]Budget[Product Category]* : *Single (Product filters Budget)Yes
Date[Year Month]Budget[Year Month]* : *Single (Date filters Budget)Yes
Customer[Region]Budget[Region]* : *Single (Customer filters Budget)Yes

Many-to-many cardinality is acceptable for a fact at a coarser grain than its dimension, as with Budget. Keep it single direction so the dimension filters the fact and never the reverse.

Bidirectional filtering is acceptable in narrow cases: a dimension-to-bridge relationship in a true many-to-many pattern, or a small dimension that must show only members with data. Even then, prefer CROSSFILTER inside the specific measure that needs it, so the behavior does not leak into every query. Bidirectional relationships across a model create ambiguous filter paths, and the engine will deactivate relationships to resolve them, often in ways nobody intended.

Rule of thumb

If you are reaching for a bidirectional relationship to make a visual "work," check the grain first. The usual cause is a fact at a different grain than assumed or a missing conformed dimension.

Role-playing dates

fact_sales has two dates. There are two ways to model that:

One Date table, inactive relationshipSeparate Order Date and Ship Date tables
Model sizeOne date tableTwo (date tables are small, so this rarely matters)
User experienceOne Date to slice by; ship-date views come from specific measuresTwo clearly named tables to slice by
Slice by both roles at onceNot possible ("ordered in March, shipped in April")Natural
Measure countA ship-date variant per measure that needs oneNo extra measures
Time intelligenceOne marked date tableEach table must be marked and kept in sync

Use the inactive relationship when the second role is needed in a handful of measures. Duplicate the table when users genuinely analyze by both roles or many measures need the second role.

Sales by Ship Date =
CALCULATE (
    [Net Sales],
    USERELATIONSHIP ( Sales[Ship Date Key], 'Date'[Date Key] )
)

In Direct Lake, check whether your model can map the same Delta table to two model tables. If it cannot, the alternatives are a physical copy of dim_date (cheap) or a view, which on the SQL endpoint triggers DirectQuery fallback and is unavailable on Direct Lake on OneLake.

Measures, folders and hidden keys

Every number a user sees should be an explicit measure. Implicit measures (dragging a numeric column and letting the visual sum it) cannot be governed, behave wrongly for semi-additive and non-additive columns, and are disabled once you add calculation groups. Set the model to discourage implicit measures and hide the underlying fact columns.

Net Sales    = SUM ( Sales[Net Amount] )
Gross Sales  = SUM ( Sales[Gross Amount] )
Discount     = SUM ( Sales[Discount Amount] )
Units        = SUM ( Sales[Quantity] )
Cost         = SUM ( Sales[Cost Amount] )
Gross Margin = [Net Sales] - [Cost]
Margin %     = DIVIDE ( [Gross Margin], [Net Sales] )
Net Sales PY = CALCULATE ( [Net Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
YoY %        = DIVIDE ( [Net Sales] - [Net Sales PY], [Net Sales PY] )

Organize with a dedicated Measures table and display folders (Sales, Margin, Time Comparison, Inventory, Budget). Then hide everything a report author should not touch: every Key column, valid_from, valid_to, is_current, hash and audit columns, and raw fact columns. Set sort-by columns (Month Name by Month Number), data categories, and format strings on measures rather than in visuals. Write a description on every measure; Copilot and data agents read them.

Time intelligence and semi-additive measures

Mark Date as the date table, ensure it has one contiguous row per day covering full years, and turn off auto date/time so the model does not grow a hidden date table per date column. Standard functions such as SAMEPERIODLASTYEAR and DATESYTD then work against it. Calculation groups can replace the explosion of PY, YTD and YoY variants for every base measure; they cost some transparency (format strings and precedence need care), so introduce them once the base measure list is stable. Microsoft has also been previewing calendar-based time intelligence for week-based and retail calendars; treat it as worth evaluating rather than a default.

Inventory needs a closing balance, not a sum over days:

On Hand Units =
VAR LastDayWithData =
    LASTNONBLANK ( 'Date'[Date], CALCULATE ( SUM ( Inventory[On Hand Qty] ) ) )
RETURN
    CALCULATE ( SUM ( Inventory[On Hand Qty] ), LastDayWithData )

LASTNONBLANK avoids the classic LASTDATE bug, where the current month shows blank because its last calendar day has no snapshot yet. On very large snapshots, a variant that finds the maximum snapshot date once can be faster; measure before optimizing.

Aggregations, security and what belongs where

Aggregations. User-defined aggregation tables (an Import aggregate over a DirectQuery detail table) are a mature pattern for very large DirectQuery models. With Direct Lake on well-maintained Delta tables, the need is smaller; when you do need a pre-aggregated table, build it in gold as an agg_ table so it is tested like any other.

Row-level security. Define roles in the model, filtering dimension tables (Salesperson or Customer[Region]), never fact tables directly. Filtering the dimension lets the relationship do the work and keeps the rule in one place.

In Microsoft Fabric

For Direct Lake on the SQL analytics endpoint, row-level or object-level security defined in the SQL endpoint or Warehouse forces queries to fall back to DirectQuery, because the semantic engine cannot apply SQL security when it reads Delta files directly. Keep RLS in the semantic model for Direct Lake. OneLake security is maturing as a storage-level alternative; check how your Direct Lake flavor honors it before relying on it.

LogicWarehouse or lakehouseSemantic model (DAX)
Row-level arithmetic (net_amount)YesNo
SCD history, surrogate keys, unknown membersYesNo
Static bands and groupings (price band)Yes, as a dimension columnOnly if it depends on a user selection
Ratios (Margin %)Store the componentsYes
Time comparisons (Net Sales PY, YoY %)NoYes
Currency conversionYes, when the rate is fixed per transactionYes, when the user picks the rate date or currency
Rule of thumb

If it is computed per row and does not depend on filter context, push it upstream. If it depends on what the user selected, it is a measure.

Open question

As semantic link puts DAX measures in reach of notebooks and metrics layers appear in other tools, should measure definitions live only in the semantic model? See Open questions.

See it

The Star schema explorer shows active and inactive relationships, and the Column lineage tracer follows a measure such as Margin % back to its source columns.