Time Intelligence calculations are among the most frequent requirements in business reporting. Executives need to compare current sales against prior months, calculate fiscal year-to-date figures, and analyze Year-over-Year (YoY) percentage growth.
TOTALYTD, SAMEPERIODLASTYEAR, DATEADD) to work accurately, your model MUST contain a dedicated Calendar / Date Table that fulfills these four strict criteria:
1. It must contain a column of data type Date with continuous dates (no missing days).
2. It must span full years covering all transaction dates in your fact tables.
3. It must be marked as an official Date Table (Mark as Date Table in Power BI Desktop).
4. It must connect to your Fact table via a 1-to-Many ($1 : *$) relationship.Cumulative functions aggregate values from the beginning of a period up to the current date in context:
Comparing metrics against historical benchmarks is straightforward using SAMEPERIODLASTYEAR and DATEADD.
While SAMEPERIODLASTYEAR shifts dates back by exactly 1 year, DATEADD offers full flexibility:
TOTALYTD?SAMEPERIODLASTYEAR(DateCol) and DATEADD(DateCol, -1, YEAR)?[Total Sales] - CALCULATE([Total Sales], SAMEPERIODLASTYEAR(Dim_Date[Date])) compute?DIVIDE([YoY Variance], [Sales Prior Year], 0) rather than the standard / division operator?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Project requirements for Intermediate Level | Iterators (SUMX, AVERAGEX) |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Combine 15 complete courses, 150 chapters, 541 topics, live SQL/Power BI/Tableau dashboards, and Scikit-Learn capstones at MSK Institute Shikohabad or Live Online.