cancel
Showing results for 
Search instead for 
Did you mean: 

TIMEADD

Super User
865 Views
Super User
Super User

TIMEADD

Does for time what DATEADD does for dates. 

 

 

TIMEADD = 
//User setttings
VAR __add = IF(MAX(Operations[Operation])="SUBTRACT",FALSE(),TRUE())
VAR __unit = MAX(Unit[Unit])
VAR __units = [Units Value] 
VAR __time = NOW() //Change to desired time value if necessary
//Constants
VAR __hour = 1/24
VAR __minute = __hour/60
VAR __second = __minute/60
//Calculations
VAR __sign = IF(__add,1,-1)
VAR __unit2use = SWITCH(__unit,"HOURS",__hour,"MINUTES",__minute,"SECONDS",__second,0)
RETURN
__time + 1*__sign * __units * __unit2use

 

 

 


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!