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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Date/TIme variance based on day only (ignoring time)

I have got two date/time fields in the table that I am using in a nested if statement that calculates the variance between them. I want power bi to ignore the hours completely and calculate the variance based on days only

Example:

What I get : (01/01/2020 00:00:00) -( 01/01/2020 17:00:00) =  1

What I would like to see  (01/01/2020 00:00:00) -( 01/01/2020 17:00:00) =   0 ( because the day is the same) 

Formula extract:

VAR = IF(ISBLANK(tasks[TaskFinishDate]), 9999,
IF(tasks[DEP TYPE1]="GIVE",(tasks[ Forecast 9th Mar]- tasks[TaskFinishDate]),
 8888))
 
Thank you 
 
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Use INT([datetime])

 

This will drop the decimal portion of your date time column.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

The best way is to store date and time separately. Then you won't have such problems.

Best
D
Greg_Deckler
Community Champion
Community Champion

Use INT([datetime])

 

This will drop the decimal portion of your date time column.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  Thank you very much, one last question is there a way to apply INT per formula rather than per each date column ( as my formula has quite a few lines) ?  

so that instead of INT(date1)-INT(date2)

something like INT([date1]-[date2]) - this didnt work but wondering if there is a way to do this ?

 

Thank you

 

Might be able to use TRUNC


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.