Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vijay22kar
Helper II
Helper II

Calculate number of days from two different dates

Hi,

Calculate no. of days from two different dates in Dax (e.g. start date is '2019-07-05'  and end date is '2020-01-10').

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @vijay22kar 

look at DATEDIFF() function https://docs.microsoft.com/en-US/dax/datediff-function-dax 

DATEDIFF(DATE(2019,7,5), DATE(2020,1,10), DAY )

or

= DATEDIFF(Table[StartDate], Table[EndDate], DAY )

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

4 REPLIES 4
az38
Community Champion
Community Champion

Hi @vijay22kar 

look at DATEDIFF() function https://docs.microsoft.com/en-US/dax/datediff-function-dax 

DATEDIFF(DATE(2019,7,5), DATE(2020,1,10), DAY )

or

= DATEDIFF(Table[StartDate], Table[EndDate], DAY )

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi @az38, there is a year and month is different

az38
Community Champion
Community Champion

@vijay22kar 

and what is the problem?

whats your desired output?

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

datediff(first_date,second_date,day)

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

check my blog here
https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/91...

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors