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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yios
Helper I
Helper I

DAX Shift back a datetime variable 70 minutes

Hi all

I have a calculated column which computes a datetime value and stores it in a var.

Then i want to reduce this datetime 70 minutes, for example var has value 2/8/2019 15:00 pm and i want to return 2/8/2019 13:50 pm

How can i do it?

 

I have seen in other posts a method with M language but i need a method with DAX code.

 

Thanks in advanced  

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @yios

Datetime type is actually a number where the integer part represents the days and the part behind the decimal separator a fraction of a day. 1/24 would be 1 hour, 1/(24*60) one minute. Based on this you can subtract 70 minutes simply by subtracting 70*/(24*60) from the datetime variable: 

NewColumn =  Table1[TimeStamp] - 70*/(24*60)

Then convert NewColumn to type DateTime again (the result of the operation will be a decimal number initially)   

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @yios

Datetime type is actually a number where the integer part represents the days and the part behind the decimal separator a fraction of a day. 1/24 would be 1 hour, 1/(24*60) one minute. Based on this you can subtract 70 minutes simply by subtracting 70*/(24*60) from the datetime variable: 

NewColumn =  Table1[TimeStamp] - 70*/(24*60)

Then convert NewColumn to type DateTime again (the result of the operation will be a decimal number initially)   

Thanks @AlB 

It works!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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