Forum Discussion
ricgin
10 years agoRegular Visitor
Days between two dates columns in DirectQuery
Hello community, I tried, unsuccesfuly, to subtract two date in DirectQuery but impossible.. How can I do this?
pqian
10 years agoMicrosoft Employee
ricgin, in the query editor, you should be able to substract two date columns by simply using the "-" operator. There's a ribbon operation for this: select the two columns, go to Add Column -> Time -> Substract.
The resultant column is of type Duration. When loaded into AS this will get converted to a bigint, which is accurate to 0.1ms. Then you can use simple math to extract the portion of this field. For example, to get to the total number of days:
Column = [TimeDifference] / 1E7 / 60 / 60 / 24
Anonymous
9 years agoNot applicable
I get the same result via this method.
! This step results in a query that is not supported in DirectQuery mode.