Time Intelligence Flashcards

(37 cards)

1
Q

What is the “Standard Time-Related Calculations” pattern?

A

A DAX pattern that uses built-in time intelligence functions (e.g. DATESYTD, DATEADD, etc.) over a standard Gregorian calendar (Jan–Dec, fixed quarters, etc.) to compute things like YTD, period-over-period, moving totals, moving averages, etc.

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

Q: What are the requirements for the Date table in this pattern?

A

Should cover a continuous date range (start Jan 1, end Dec 31, include all days);
Have a unique Date column (no time component)
Marked as a Date Table in the model (so DAX can apply REMOVEFILTERS automatically when time intelligence functions run)

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

Q: When should you consider using custom time-related calculations instead of the standard pattern?

A

A: When your business calendar doesn’t follow a standard Gregorian layout (e.g. fiscal year starting in March, 4-4-5 week calendars, week-based calendars, etc.), or when built-in functions fail to meet your requirement.

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

Q: In the naming convention used by the pattern, what does “QTD” stand for?

A

A: Quarter-to-Date — the aggregate of a measure from the start of the quarter up to the current date in context.

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

Q: What is “MAT” in this pattern?

A

A: Moving Annual Total — the rolling total of the measure over the last 12 months (or last year window) relative to the current date.

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

Q: What does “PY” stand for, and what is its role?

A

A: Previous Year — used for shifting measures (e.g. to compute same period last year). The measure labeled PY returns the value of the measure in the prior year period, adjusted for filter context.

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

Q: What is “POP” and when would you use it?

A

Period-over-Period — a dynamic comparison measure that automatically switches between year-over-year, quarter-over-quarter, or month-over-month depending on the grain (i.e. the “scope”) of the report.

Sales POP :=
SWITCH ( TRUE,
ISINSCOPE ( ‘Date’[Year Month] ), [Sales MOM],
ISINSCOPE ( ‘Date’[Year Quarter] ), [Sales QOQ],
ISINSCOPE ( ‘Date’[Year] ), [Sales YOY] )

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

Q: How is “YTDOPY” used or interpreted?

A

A: Year-to-date over previous year — compares the YTD value in the current year against the full value of the prior year, to see how the current year’s accumulation stacks up to a full prior year.

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

Q: Write a basic Sales YTD measure using CALCULATE and DATESYTD.

A

Sales YTD :=
IF (
[ShowValueForDates],
CALCULATE ( [Sales Amount], DATESYTD ( ‘Date’[Date] ) )
)

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

Q: How would you write Sales QTD similarly?

A

Sales QTD :=
IF (
[ShowValueForDates],
CALCULATE ( [Sales Amount], DATESQTD ( ‘Date’[Date] ) )
)

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

Q: Show the Sales MTD formula.

A

Sales MTD :=
IF (
[ShowValueForDates],
CALCULATE ( [Sales Amount], DATESMTD ( ‘Date’[Date] ) )
)

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

Q: How to compute Sales PY (Previous Year) using DATEADD or similar?

A

Sales PY :=
IF (
[ShowValueForDates],
CALCULATE (
[Sales Amount],
CALCULATETABLE (
DATEADD ( ‘Date’[Date], -1, YEAR ),
‘Date’[DateWithSales] = TRUE()
)
)
)

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

Q: Write Sales YOY % (year-over-year percentage) given existing Sales and Sales PY measures.

A

Sales YOY % :=
DIVIDE ( [Sales Amount] - [Sales PY], [Sales PY] )

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

Q: Provide a Moving Annual Total (MAT) measure.

A

Sales MAT :=
IF (
[ShowValueForDates],
CALCULATE (
[Sales Amount],
DATESINPERIOD ( ‘Date’[Date], MAX ( ‘Date’[Date] ), -1, YEAR )
)
)

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

Q: How would you compute the Moving Annual Total Growth % (MATG) in this pattern?

A

Sales MAT Growth % :=
DIVIDE (
[Sales MAT] - CALCULATE ( [Sales MAT], DATEADD ( ‘Date’[Date], -1, YEAR ) ),
CALCULATE ( [Sales MAT], DATEADD ( ‘Date’[Date], -1, YEAR ) )
)

the moving annual total is usually computed at the month or day granularity to show trends in a chart

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

Q: Write a formula for 30-day rolling average using AVERAGEX + DATESINPERIOD.

A

Sales 30D Avg :=
VAR DateWindow =
DATESINPERIOD ( ‘Date’[Date], MAX ( ‘Date’[Date] ), -30, DAY )
VAR RowCount = COUNTROWS ( DateWindow )
RETURN
IF (
RowCount >= 7, – guard for enough days
AVERAGEX ( DateWindow, [Sales Amount] )
)

17
Q

Q: What does DATESYTD(‘Date’[Date]) return?

A

A: All dates from January 1 of the current year to the last date visible in the filter context.

18
Q

Q: What function gives all dates in the previous year?

A

A: SAMEPERIODLASTYEAR(‘Date’[Date]) or equivalently DATEADD(‘Date’[Date], -1, YEAR)

19
Q

Q: What is the difference between DATEADD and SAMEPERIODLASTYEAR?

A

DATEADD shifts a date range by any number of intervals (days, months, years, etc.).

SAMEPERIODLASTYEAR only shifts by exactly one year and preserves irregular month lengths.

20
Q

Q: What’s the difference between ENDOFMONTH and EOMONTH?

A

ENDOFMONTH → returns a table (time intelligence).

EOMONTH → returns a scalar date (use in calculations, not filters).

21
Q

Q: What’s the difference between PREVIOUSDAY and subtracting 1 from a date?

A

PREVIOUSDAY → returns a table (for filters). This function is reliable even when your data source has gaps (e.g., no sales on a specific day). It will correctly identify the previous date based on the calendar table, rather than just the previous entry in your data table

Date - 1 → returns a scalar (for row or value calculations).

22
Q

Q: When should you use EDATE instead of DATEADD?

A

A: When shifting a single date value by a number of months (e.g., invoice due dates). DATEADD shifts entire sets of dates in filters.

EDATE(< start_date >, < months >)

23
Q

Q: What does DATESBETWEEN do?

A

A: Returns a table of dates between two specified boundary dates.

24
Q

What does TOTALYTD do?

A

Returns the year-to-date total of a measure using a date column; it’s equivalent to CALCULATE([Measure], DATESYTD(‘Date’[Date])).

25
How is TOTALYTD different from using CALCULATE with DATESYTD?
They produce the same result; TOTALYTD is a shorthand wrapper for CALCULATE([Measure], DATESYTD(...)) and allows optional filters and a fiscal-year-end argument.
26
What arguments does TOTALYTD accept?
The measure to aggregate. The date column. Optional filter expression. Optional fiscal year-end date literal, e.g. "6-30".
27
What is the purpose of the second argument in DATESYTD?
It defines the fiscal year-end date, such as "6-30" for a fiscal year ending June 30. ## Footnote DATESYTD(< dates > or < calendar > [,< year _ end _ date >])
28
Can the fiscal-year-end argument in DATESYTD be dynamic?
No, it must be a literal date string like "6-30", not an expression or variable.
29
What does DATESINPERIOD return?
A table of dates starting from a reference date and extending forward or backward by a specified interval (day, month, quarter, or year). ## Footnote DATESINPERIOD(< dates > or < calendar >, < start _ date >, < number _ of _ intervals >, < interval >)
30
How can you use DATESINPERIOD for a rolling 12-month total?
CALCULATE([Sales Amount], DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH))
31
What is SAMEPERIODLASTYEAR?
SAMEPERIODLASTYEAR(< dates > or < calendar> ) A function that returns all dates from the same period one year earlier, **preserving irregular month lengths or leap years.** ## Footnote The dates returned are the same as the dates returned by this equivalent formula: DATEADD(dates, -1, year)
32
How does SAMEPERIODLASTYEAR differ from DATEADD('Date'[Date], -1, YEAR)?
Both shift one year back, but DATEADD shifts the date range by an interval count, while SAMEPERIODLASTYEAR ensures the exact same range length and alignment across years.
33
What does PREVIOUSMONTH return?
A table containing all dates in the calendar month immediately before the current filter context.
33
What does PREVIOUSDAY return?
A table containing all dates from the day immediately before the current filter context.
34
How is EOMONTH different from ENDOFMONTH?
EOMONTH returns a single date (scalar). ENDOFMONTH returns a table of the last date in the month (used in time intelligence).
35
How does DATESBETWEEN differ from DATESINPERIOD?
DATESBETWEEN uses explicit start and end boundaries. DATESINPERIOD uses a single reference date plus a relative interval.
36
What does EDATE do?
Returns a date that is a specified number of months before or after a given date—useful for scalar date arithmetic.