Sub topic 13
Checking the table and fixing common problems
This chapter assumes you have built a date table with DAX or Power Query, related it to a fact table, and marked it as the date table. You should also know basic DAX measures such as SUM, CALCULATE, and TOTALYTD. Here you will verify that the table is correct and learn to diagnose the problems that most often break time intelligence.
Why validate before you trust the numbers
Time intelligence functions rarely raise an error when the date table is wrong. They return a plausible number that is wrong. A year-to-date total that silently skips three weeks or a prior-year figure that repeats the current year will pass a quick glance and fail an audit. A short validation routine catches these problems before report users do.
The checks fall into three groups:
- Structure of the date table: is it complete, unique, and typed correctly?
- Connection to the facts: does every fact date find a match?
- Behavior of the measures: do they return values you can confirm by hand?
Checking the table structure
Start in Table view and look at the date column. Then confirm the requirements from earlier in this tutorial with a few queries. You can run these in DAX query view, or create a temporary calculated table to see the results.
The following query returns one row of facts about the date table. It reports the first and last date, the number of rows, the number of distinct dates, and the number of days the range should contain.
EVALUATE
ROW (
"First date", MIN ( 'Date'[Date] ),
"Last date", MAX ( 'Date'[Date] ),
"Rows", COUNTROWS ( 'Date' ),
"Distinct dates", DISTINCTCOUNT ( 'Date'[Date] ),
"Expected days", DATEDIFF ( MIN ( 'Date'[Date] ), MAX ( 'Date'[Date] ), DAY ) + 1
)Read the result like this:
- Rows equals distinct dates. If not, the table has duplicates, and the marking step will fail or relationships will be many-to-many.
- Rows equals expected days. If rows is smaller, the table has gaps. Time intelligence functions need every day in the range.
- First date is January 1 and last date is December 31. A table that starts mid-year gives wrong year-to-date and prior-year values for the partial years at either end.
- No blanks. A blank in the date column is not allowed in a marked date table.
Also check the data type of the date column. It must be Date, not Date/Time with a time component, and not text. In Power Query, the Table.TransformColumnTypes step with type date guarantees this. In a DAX table built with CALENDAR, the type is already correct.
Checking coverage of the fact table
A date table can be perfectly formed and still fail to cover your data. Compare the fact table's range with the date table's range.
EVALUATE
ROW (
"Fact first", MIN ( Sales[OrderDate] ),
"Fact last", MAX ( Sales[OrderDate] ),
"Date table first", MIN ( 'Date'[Date] ),
"Date table last", MAX ( 'Date'[Date] )
)The date table's first date must be on or before the fact's first date, and its last date on or after the fact's last date. If the fact table gets new data each refresh, a hard-coded range such as CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2026, 12, 31 ) ) will eventually stop covering it. The version that derives its range from MIN and MAX of Sales[OrderDate] extends itself on refresh, so prefer it when the data keeps growing.
Finding fact rows with no matching date
Rows whose date is missing from the date table do not disappear. Power BI groups them under a blank row in the date table, which shows up as a (Blank) value in visuals. This measure counts them:
Unmatched Sales Rows =
COUNTROWS (
FILTER ( Sales, ISBLANK ( RELATED ( 'Date'[Date] ) ) )
)A result of zero means every sales row matches a date. A nonzero result means either the date table does not cover those dates or the fact column has values the date table cannot match, such as a time component (see the table of problems below).
Checking the relationship and the marked table
Open Model view and confirm four details:
- The relationship runs from
'Date'[Date](one side) to the fact date column (many side). - The cardinality is one-to-many and the filter direction is single, from the date table to the fact table.
- The relationship is active for the date column your main measures use.
- The date table is marked. In Table view, select the table and use Table tools > Mark as date table. The date column you pick must be the one with unique
Datevalues.
Marking has a side effect worth knowing. Once a table is marked, Power BI turns off the automatic date/time behavior for the columns of that table. It also makes time intelligence functions work reliably against the marked column, even when a function is given a different date column from the same table.
Checking measures against a known value
Structure checks prove the table is well formed. Measure checks prove it behaves. Build a small matrix with 'Date'[Year] and 'Date'[Month] on the rows, then add the measures from the previous chapter.
Total Sales = SUM ( Sales[Amount] )
Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] )
Sales PY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )Then verify by hand:
- December's Sales YTD equals the full-year Total Sales for that year. This confirms that YTD accumulates across all twelve months.
- January's Sales YTD equals January's Total Sales. This confirms YTD restarts each year.
- This year's Sales PY for a month equals last year's Total Sales for the same month. Pick one month and compare the two cells.
- The first year in the data has a blank Sales PY. A value there suggests the filter is not working as expected.
If you want a stronger check, write a test measure that compares a time-intelligence result against an independent calculation, then show it in a card or table. A difference of zero for every month is the goal.
PY Check =
VAR _py = [Sales PY]
VAR _direct =
CALCULATE (
[Total Sales],
DATEADD ( 'Date'[Date], -1, YEAR )
)
RETURN
_py - _directBoth approaches shift the filter back one year, so they should agree whenever the date table is complete. A nonzero difference points to a gap or a boundary problem in the table.
Common problems and their fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| "Mark as date table" is rejected | Duplicate dates, blanks, or a column that is not `Date` type | Remove duplicates and blanks, and set the type to `Date` |
| Month names sort alphabetically (Apr, Aug, Dec) | No sort-by-column set | Set `Month` to sort by `Month Number` |
| Year-to-date resets at the wrong time | Fiscal year not passed to `TOTALYTD`, or calendar year used for a fiscal report | Add the year-end argument, for example `"6/30"` |
| Prior-year value is blank for a full year of data | The date table does not extend one year earlier than the facts | Start the date table at least a year before the first fact date |
| `(Blank)` row appears in visuals | Fact dates fall outside the date table, or carry a time component | Extend the range, or remove the time from the fact column |
| Measures return the same value in every row | Visual uses the fact table's date column instead of the date table's | Use columns from `'Date'` in visuals and filters |
| Ship-date measure shows no data | Second relationship is inactive and the measure does not activate it | Wrap the measure with `USERELATIONSHIP` |
| Extra hidden `LocalDateTable` tables inflate the model | Auto date/time is still on | Turn off Auto date/time in Options and settings |
| Totals look right but monthly figures are off | Date table has gaps | Rebuild with `CALENDAR` or `List.Dates`, which produce every day |
The time-component trap
A fact column of type Date/Time can hold values such as 2026-03-14 09:30. The date table holds 2026-03-14 00:00. The two do not match, so the relationship finds no partner for most rows. The fix is to convert the fact column to type Date in Power Query, or to build a separate date-only column. Doing it in Power Query keeps the model smaller than adding a calculated column.
Using the wrong column in a visual
A frequent mistake is to put Sales[OrderDate] on an axis or slicer instead of 'Date'[Date]. The visual then groups by the fact column, and time intelligence functions that depend on the date table's filter context do not behave. Hide the fact table's raw date columns from Report view so report authors pick the date table's columns by default.
Missing years at the edges
SAMEPERIODLASTYEAR for the first year of data has nothing to shift to. If the date table begins exactly on the first fact date, the first year's prior-year comparison is blank, which is correct. If it starts later than the first fact date, rows before the start are unmatched. This is why the range should start on January 1 of the first year, and why it is also worth checking the coverage query shown earlier.
A fiscal calendar that does not line up
If your fiscal year ends June 30, check three things. Fiscal Year should increase on July 1. Fiscal Month Number should be 1 for July and 12 for June. Sales Fiscal YTD should restart each July. Test it with a matrix of Fiscal Year and Month sorted by Fiscal Month Number. July must be the first row under each fiscal year, and June's YTD must equal the fiscal year total.
A short checklist
Use this list after building or modifying a date table.
- Dates are unique, with no blanks, and the column type is
Date. - Rows equal the number of days between the first and last date, plus one.
- The range covers whole calendar years, and extends at least a year before the first fact date if you need prior-year comparisons for that year.
- Text columns such as
Monthsort by their numeric counterparts. - The relationship is one-to-many from the date table, single direction, and active.
- The table is marked as the date table, and Auto date/time is off.
- December's YTD equals the year total, and January's YTD equals January's total.
- Unmatched fact rows count is zero.
Exercise
A report shows Sales PY as blank for every month of 2024, although the fact table contains orders from 2023. The date table was built with CALENDAR ( DATE ( 2024, 1, 1 ), DATE ( 2026, 12, 31 ) ). What is wrong, and how do you fix it?
Show answer
The date table starts on January 1, 2024, so it has no 2023 dates. SAMEPERIODLASTYEAR shifts 2024 dates back one year, and those 2023 dates do not exist in the table, so the result is blank. The 2023 fact rows are also unmatched and appear under a (Blank) row. Fix it by starting the table at January 1 of the first year in the fact data, for example with DATE ( YEAR ( MIN ( Sales[OrderDate] ) ), 1, 1 ), so the table covers 2023 as well.
Exercise
Your validation query shows 2,557 rows but only 2,540 distinct dates in the date table, and Mark as date table is rejected. Name the cause and one way to confirm it.
Show answer
The table contains duplicate dates, 17 extra rows in this case. Marking requires unique values. To confirm, add a calculated table or DAX query that groups by the date column and keeps groups with a count greater than one, for example FILTER ( SUMMARIZE ( 'Date', 'Date'[Date], "Count", COUNTROWS ( 'Date' ) ), [Count] > 1 ). Then remove the duplicates in the source query, or rebuild the table with CALENDAR or List.Dates, which produce each date once.
Exercise
Sales rows from March 14, 2026 show up under (Blank) in a matrix, although the date table covers that day. The fact column is Date/Time. Why does this happen and what is the cleanest fix?
Show answer
The fact values include a time such as 09:30, while the date table holds midnight values. The values do not match, so the relationship finds no date for those rows. The cleanest fix is to change the fact column's type to Date in Power Query, which removes the time before the data loads. A calculated date-only column also works but adds to the model size.