• Skip to main content
  • Skip to footer

Curbal

Learn how to grow your business with your data and Power BI

  • Data Stories
    • Power BI Stories
    • 1 dataset, 100 matplotlib visualizations
  • Learning Portal
    • Download Center
    • 25 Days Challenge
    • DAX Glossary
    • Power BI
    • Power BI by Topic
    • Python
    • 1 dataset, 100 matplotlib visualizations
  • Courses
    • Power BI Mini Master Class 1: Using a REST API as a data source
    • Power BI Master Class 1: COVID Tracker
    • Introduction to Power BI – FREE Online course
    • M Language + Power Query Course Bundle
    • Power Query Online Training [updated 2022]
    • M Language Online Course: The unofficial and Practical Reference Guide [updated 2025]
    • My Courses
  • Shop
    • Courses
    • Master Classes
    • Template Apps
    • JSON Themes
  • Cart
  • Register/ Log In
    • Become a Member
    • Log In
    • My account
    • My Courses
  • Search
  • Contact
You are here: Home / CM Tooltip Glossary Pro+ / DATEDIFF

DATEDIFF

posted on August 23, 2017

« Back to Glossary Index

Syntax

DATEDIFF(<start_date>, <end_date>, <interval>)

Learn with examples!

Let me demonstrate how DATEDIFF work using different real scenarios:

Example1: Calculate the difference between two dates in Power BI

In today’s video, I will show you how to calculate the difference between two dates using DATEDIFF.
I also show you how to overcome the issue when the start date is larger than the end date.

DAX Fridays! #17: DATEDIFF

Links to the mentioned resources

To get the files:
1. Go to Curbal Download Center > Dax Fridays
2. Get File #17

Example2: Deconstruct a DAX measure

In today’s video we will deconstruct a measure that was created by a Microsoft employee in the Power BI community:

Link to the Power BI community post: https://community.powerbi.com/t5/Desktop/Calculate-duration-based-on-dates-in-different-rows/td-p/58886

In this video we will go also through the functions:
05:56 LOOKUPVALUE
09:12 DATEDIFF

DAX Fridays! #54: Reverse engineer/ Deconstruct a DAX measure

Links to the mentioned resources

To get the files:
1. Go to Curbal Download Center > Dax Fridays
2. Get File #54

Example 3: Calculate the difference between two dates in the same column in Power BI

Do you know how to calculate the difference between dates when both are in the same column?

One example of when this is needed is when you are working with subscription based services. If you want to calculate how many dates go between users changing subscriptions, this DAX measure will help you.

DAX Fridays! #85: Difference between dates in the same column

Links to the mentioned resources

To get the files:
1. Go to Curbal Download Center > Dax Fridays
2. Get File #85

Example 4: Create a relative week filter in Power BI

When the custom date filter in Power BI doesn’t do what you need, how you create your own? What if you need to do it by week?

DAX Fridays! #131: Create a custom relative date filter in Power BI

Links to the mentioned resources

To get the files:
1. Go to Curbal Download Center > Dax Fridays
2. Get File #131

Remarks

An error is returned if start_date is larger than end_date.

Was this helpful?
See Also:
  • LOOKUPVALUE
  • MINUTE
  • MOD
  • QUOTIENT
  • TIMEVALUE
« Back to Index

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer CTA

Join our community of +50,000 professionals

Become a Member

Subscribe to YouTube

About me:

Curbal AB
Badhusgatan 7B
722 15 – Västerås
Sweden

OrgNo: 5569680852 | VAT: SE556968085201

 

Location:

© Copyright 2014-2025 · Curbal AB · All Rights Reserved · Privacy Policy · Terms of Service · Refund Policy · Log In