cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Datediff function is giving always negative values

Hi,

I am using the below expression:

Recv Split = DATEDIFF('Data'[LW_RECEIVE_END_DATE_TIME], 'Data'[LW_RECEIVE_START_DATE_TIME], SECOND)

and my source data is like below:

date Data.PNG

But I am always getting negative values. Please help me.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Datediff function is giving always negative values

@dsandip59 ,

 

Start_Date should be in the first parameter position while End_Date be in the second parameter as below.

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Anonymous
Not applicable

Re: Datediff function is giving always negative values

Have you tried flipping the start and end times?

 

Ex. Recv Split = DATEDIFF('Data'[LW_RECEIVE_START_DATE_TIME],'Data'[LW_RECEIVE_END_DATE_TIME],  SECOND)

 

This is a really lazy work around but couldn't you multiply the function by -1? If it is always giving you negatives that should work. 

 

Ex. Recv Split = DATEDIFF('Data'[LW_RECEIVE_START_DATE_TIME],'Data'[LW_RECEIVE_END_DATE_TIME],  SECOND)*-1

Highlighted
Community Support
Community Support

Re: Datediff function is giving always negative values

@dsandip59 ,

 

Start_Date should be in the first parameter position while End_Date be in the second parameter as below.

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors