Global edit history

How to write efficient DAX Time Intelligence measures (YTD, Prior Year, Moving Averages)?

PowerBI & DAX Measures · 2 saved versions

Back to thread

Version 1 (Edit)

Edited by Rajesh Sharma · Aug 24, 2026 4:43 AM

0 edit points 0 upvotes
Change note

Content depth regeneration via community:regenerate-content

Title snapshot

How to write efficient DAX Time Intelligence measures (YTD, Prior Year, Moving Averages)?

Summary snapshot
Building dedicated Date Tables and using `TOTALYTD`, `SAMEPERIODLASTYEAR`, and `DATESINPERIOD`.
Content snapshot
### DAX Code Blueprint ```dax Sales YoY Growth = VAR CurrentSales = [Total Sales] VAR PriorSales = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])) RETURN DIVIDE(CurrentSales - PriorSales, PriorSales, 0) ``` Always pair time intelligence functions with a contiguous, marked Date table.
Source snapshot

https://developers.google.com/search/docs

Version 1 (Original Post)

Published by Rajesh Sharma · Aug 9, 2026 5:37 AM

Original Publication
Events Log

Post originally created and published to the Global Hub.

Original Title

How to write efficient DAX Time Intelligence measures (YTD, Prior Year, Moving Averages)?

Original Summary
Building dedicated Date Tables and using `TOTALYTD`, `SAMEPERIODLASTYEAR`, and `DATESINPERIOD`.
Original Content
### DAX Code Blueprint ```dax Sales YoY Growth = VAR CurrentSales = [Total Sales] VAR PriorSales = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])) RETURN DIVIDE(CurrentSales - PriorSales, PriorSales, 0) ``` Always pair time intelligence functions with a contiguous, marked Date table.
Original Sources

https://developers.google.com/search/docs