Forum Discussion
Anonymous
6 years agoNot applicable
How to Round to Start Hour, DirectQuery!
Dear all, I need to round current time to the start hour, but i'm working in direct query. When i try do this on "edit query" tell me that's not supported in direct query mode. I need to...
- 6 years ago
Hi Anonymous ,
We can create a calculated column to meet your requirement:
StartHour = [DateTime] - DIVIDE ( MINUTE ( [DateTime] ), 60 * 24, 0 ) - DIVIDE ( SECOND ( [DateTime] ), 3600 * 24, 0 )
Best regards,
v-lid-msft
6 years agoCommunity Support
Hi Anonymous ,
We can create a calculated column to meet your requirement:
StartHour =
[DateTime]
- DIVIDE ( MINUTE ( [DateTime] ), 60 * 24, 0 )
- DIVIDE ( SECOND ( [DateTime] ), 3600 * 24, 0 )
Best regards,
- Anonymous6 years agoNot applicable
Works it, thanks
- Anonymous6 years agoNot applicable
One more thing you do that with new mesure or new column?
I only can do it with a new column, but i noticed when i try to count all values they give me wrong resultsI have values in the order of tens and should have in the thousands.
Try to use relationships with the calendar, but get the same results.Thank you
- Anonymous6 years agoNot applicable
It is because time is not only in seconds.
Is it possible to round the date to seconds?
- Anonymous6 years agoNot applicableSolved
StartHour =MROUND(([Data_Hora]- DIVIDE ( MINUTE ( [Data_Hora] ); 60 * 24; 0 )- DIVIDE ( SECOND ( [Data_Hora] ); 3600 * 24; 0 )); TIME ( 1; 0; 0 ) ) + TIME ( 0; 0; 0 )- v-lid-msft6 years agoCommunity Support
Hi Anonymous ,
Glad to hear that you have resolved your problem.
Best regards,