cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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.
1.PNG
When i try do this on "edit query" tell me that's not supported in direct query mode.

I need to work whith direct query, i cant export all data.

It is possible to do it in another way?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to Round to Start Hour, DirectQuery!

Hi @rramos ,

 

We can create a calculated column to meet your requirement:

 

StartHour = 
[DateTime]
    - DIVIDE ( MINUTE ( [DateTime] ), 60 * 24, 0 )
    - DIVIDE ( SECOND ( [DateTime] ), 3600 * 24, 0 )

 

11.PNG

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: How to Round to Start Hour, DirectQuery!

Hi @rramos ,

 

We can create a calculated column to meet your requirement:

 

StartHour = 
[DateTime]
    - DIVIDE ( MINUTE ( [DateTime] ), 60 * 24, 0 )
    - DIVIDE ( SECOND ( [DateTime] ), 3600 * 24, 0 )

 

11.PNG

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper I
Helper I

Re: How to Round to Start Hour, DirectQuery!

Works it, thanks

Highlighted
Helper I
Helper I

Re: How to Round to Start Hour, DirectQuery!

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 results

 

1.PNG

 

I 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

Highlighted
Helper I
Helper I

Re: How to Round to Start Hour, DirectQuery!

It is because time is not only in seconds.

1.PNG

 

Is it possible to round the date to seconds?

Highlighted
Helper I
Helper I

Re: How to Round to Start Hour, DirectQuery!

Solved

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 )
Highlighted
Community Support
Community Support

Re: How to Round to Start Hour, DirectQuery!

Hi @rramos ,

 

Glad to hear that you have resolved your problem.

 

Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors