Introduction
Ever wondered how some dashboards instantly compare today’s sales with last month’s totals? The secret lies in Power BI Time Functions, the unsung heroes of DAX that unlock dynamic date calculations with a single measure. In this article, we’ll explore ten essential Power BI Time Functions, showing you exactly how and why to use each one for actionable, time-based insights. Whether you need year-to-date figures or period-over-period growth, mastering these functions will transform your reports—and accelerate your decision-making.
1. Power BI Time Functions – TODAY
Description: Returns the current date, updating at each data refresh.
Syntax:
scssCopyTODAY()
Use Case:
For example, you might build a measure like:
iniCopyDaysSinceLastSale = DATEDIFF(LASTDATE(Sales[Date]), TODAY(), DAY)
to show how many days have passed since the last recorded sale. Moreover, you can filter visuals to show “Transactions in the last X days,” always relative to the report’s refresh date.
“Time is what we want most, but what we use worst.” – William Penn
2. Power BI Time Functions – NOW
Description: Returns the current date and time, perfect for timestamping.
Syntax:
scssCopyNOW()
Use Case:
Imagine adding a “Last Refresh” card on your dashboard. By creating a measure:
iniCopyLastRefresh = NOW()
and formatting it for date and time, you provide users with immediate context about data currency—an easy credibility booster. Consequently, whenever stakeholders see stale numbers, they know exactly when the data was last updated.
3. Power BI Time Functions – DATEDIFF
Description: Calculates the difference between two dates in specified units (DAY, MONTH, YEAR, etc.).
Syntax:
php-templateCopyDATEDIFF(<StartDate>, <EndDate>, <Interval>)
Use Case:
To compute the average customer age in days:
iniCopyCustomerAge = DATEDIFF(Customer[BirthDate], TODAY(), DAY)
Alternatively, you could calculate month-over-month sales growth:
sqlCopyMOM_Growth =
DIVIDE(
[Sales This Month] - [Sales Last Month],
[Sales Last Month]
)
where [Sales Last Month]
uses DATEDIFF
internally. This function’s versatility makes it indispensable for interval analysis.
4. Power BI Time Functions – DATEADD
Description: Shifts a date by a specified number of intervals.
Syntax:
php-templateCopyDATEADD(<Dates>, <NumberOfIntervals>, <Interval>)
Use Case:
To build a “Sales Last Year” measure:
sqlCopySales_LY = CALCULATE(
[Total Sales],
DATEADD(Calendar[Date], -1, YEAR)
)
This moves the context back exactly one year. Therefore, combining DATEADD
with CALCULATE
helps you effortlessly compare performance across equivalent periods.
5. Power BI Time Functions – PARALLELPERIOD
Description: Shifts dates in parallel periods (e.g., same month last year).
Syntax:
php-templateCopyPARALLELPERIOD(<Dates>, <NumberOfPeriods>, <Interval>)
Use Case:
Use this to compare the same quarter last year:
sqlCopyQtrSales_PY = CALCULATE(
[Quarter Sales],
PARALLELPERIOD(Calendar[Date], -1, YEAR)
)
Unlike DATEADD
, PARALLELPERIOD
maintains consistent granularity. Thus, it’s ideal when comparing parallel chunks, such as quarters or months, without overlapping partial periods.
6. Power BI Time Functions – SAMEPERIODLASTYEAR
Description: Returns a set of dates from the same period in the previous year.
Syntax:
scssCopySAMEPERIODLASTYEAR(<Dates>)
Use Case:
For a year-over-year growth measure:
mathematicaCopyYOY_Growth =
DIVIDE(
[Total Sales] - CALCULATE([Total Sales], SAMEPERIODLASTYEAR(Calendar[Date])),
CALCULATE([Total Sales], SAMEPERIODLASTYEAR(Calendar[Date]))
)
This function automatically handles leap years and calendar irregularities, making year-over-year comparisons seamless and accurate.
7. Power BI Time Functions – TOTALYTD / TOTALMTD / TOTALQTD
Description: Calculates year-to-date (YTD), month-to-date (MTD), or quarter-to-date (QTD) aggregations.
Syntax:
php-templateCopyTOTALYTD(<Expression>, <Dates>[, <Filter>][, <YearEndDate>])
Use Case:
To show cumulative sales for the current year up to today:
iniCopySales_YTD = TOTALYTD([Total Sales], Calendar[Date])
Similarly, use TOTALMTD
for month-running totals or TOTALQTD
for quarter-running. This instantly conveys trajectory—whether you’re pacing ahead or lagging.
8. Power BI Time Functions – ENDOFMONTH / STARTOFMONTH
Description: Returns the last or first date of the month for a given date.
Syntax:
scssCopyENDOFMONTH(<Dates>)
STARTOFMONTH(<Dates>)
Use Case:
Calculate month-end inventory:
csharpCopyInv_EndMonth = CALCULATE(
[Inventory Value],
ENDOFMONTH(Calendar[Date])
)
Or start-of-month cash balance:
csharpCopyCash_SOM = CALCULATE(
[Cash Balance],
STARTOFMONTH(Calendar[Date])
)
These functions simplify boundary-based calculations, critical for financial and operational reporting.
9. Power BI Time Functions – HOUR / MINUTE / SECOND
Description: Extracts the hour, minute, or second component from a datetime value.
Syntax:
scssCopyHOUR(<Time>)
MINUTE(<Time>)
SECOND(<Time>)
Use Case:
Analyze peak hours:
sqlCopySalesByHour = SUMMARIZE(
Sales,
HOUR(Sales[Timestamp]),
"SalesAmt", SUM(Sales[Amount])
)
Use this in visuals to reveal sales patterns by the hour—or even by minute—helping operations staff optimize staffing and promotions.
10. Power BI Time Functions – DATEDIFF vs. DATEPART
Description: While DATEDIFF
returns intervals between dates, DATEPART
(part of SQL but achievable via combinations) can extract specific date parts. In DAX, you mimic DATEPART
with YEAR
, MONTH
, DAY
.
Syntax:
sqlCopyYEAR(<Date>) | MONTH(<Date>) | DAY(<Date>)
Use Case:
Group sales by week day:
sqlCopySalesByWeekday =
SUMMARIZE(
Sales,
WEEKDAY(Sales[Date]),
"TotalSales", SUM(Sales[Amount])
)
Here, WEEKDAY
is analogous to a date part. Combining these functions provides granular control over temporal grouping.
Conclusion
By mastering these Power BI Time Functions, you gain the power to build truly dynamic, date-aware reports. From simple “last refresh” timestamps with NOW()
to sophisticated year-over-year comparisons using SAMEPERIODLASTYEAR()
, each function offers unique value. Start integrating them today to elevate your dashboards from static snapshots to living, breathing analytics. Ready to see these functions in action? Subscribe for step-by-step tutorials and real-world examples!
Read more related articles below.
Use DAX time intelligence functions in Power BI Desktop models
Understanding Time Intelligence with DAX
Importance of Iteration DAX in Power BI
Marketing Campaign Insights Analysis: 7 Powerful Ways to Boost ROI in 2025
5 Powerful Ways to Customize Totals in Power BI Using ISINSCOPE
5 Common DAX Mistakes in Power BI
10 responses to “Power BI Time Functions: 10 DAX for Analysis”
-
It抯 in point of fact a nice and useful piece of info. I am happy that you shared this helpful info with us. Please stay us up to date like this. Thanks for sharing.
-
First off I would like to say superb blog! I had a quick question which I’d like to ask if you don’t mind. I was interested to find out how you center yourself and clear your thoughts before writing.I have had a difficult time clearing my mind in getting my ideas out there.I truly do take pleasure in writing but it just seems like the first 10 to 15 minutes are
-
I’ve been surfing online more than 3 hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the web will be much more useful than ever before.
-
I really like what you guys tend to be up too. This kind of clever work and reporting! Keep up the amazing works guys I’ve added you guys to my blogroll.
-
Hello there, You’ve done a great job. I will certainly digg it and personally recommend to my friends. I’m sure they will be benefited from this site.
-
Hello, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam feedback? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it’s driving me insane so any help is very much appreciated.
-
Appreciation to my father who informed me on the topic of this web site, this website is really amazing.
-
Good ?I should definitely pronounce, impressed with your web site. I had no trouble navigating through all the tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or anything, site theme . a tones way for your customer to communicate. Excellent task..
-
Hello there, You’ve done a great job. I will certainly digg it and personally recommend to my friends. I’m sure they will be benefited from this site.
-
When someone writes an piece of writing he/she keeps the thought of a user in his/her brain that how a user can know it. So that’s why this paragraph is outstdanding.
Discover more from The Insight Orbit
Subscribe to get the latest posts sent to your email.
Leave a Reply