cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Johnlogistic Regular Visitor
Regular Visitor

Last refresh datetime format to only display full hours

So I got this calculated column " Source = DateTimeZone.UtcNow()+#duration(0, 2, 0, 0)" Now if it refreshes it displays it as for example17:14:49. I set the formatting in powerbi itself. BUT I want if the time it refreshes is 17:14:49 it to only display 17:00:00. so only full hours. My refresh time is set at every hour starting at 9:00:00 so displayed should be 9:00:00 10:00:00 etc. I don't know how to add this filtering or fotmatting to my formula.

Btw the reason i add 2 hours is cause in powerbi service it uses UTC as refresh time so im cancelling timezone difference.

Thx in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Last refresh datetime format to only display full hours

Hi @Johnlogistic 

 

Sure try this.

let
    DateTimeNow = DateTimeZone.UtcNow() + #duration(0, 2, 0, 0),
    TimePlus2 = #time( Time.Hour( DateTimeNow ), 0, 0 ),
    DateTimePlus2 = DateTime.Date( DateTimeNow ) & TimePlus2 
in
    DateTimePlus2
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

5 REPLIES 5
Super User IV
Super User IV

Re: Last refresh datetime format to only display full hours

Hi @Johnlogistic 

 

Try this.

= #time( Time.Hour( DateTimeZone.UtcNow() ), 0, 0 )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Johnlogistic Regular Visitor
Regular Visitor

Re: Last refresh datetime format to only display full hours

Hi @Mariusz 

In this solution is the 2 hours still added? I don't see the duration added.

Super User IV
Super User IV

Re: Last refresh datetime format to only display full hours

Hi @Johnlogistic 

 

Sorry, this will include the duration.

= #time( Time.Hour( DateTimeZone.UtcNow() + #duration(0, 2, 0, 0) ), 0, 0 )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Johnlogistic Regular Visitor
Regular Visitor

Re: Last refresh datetime format to only display full hours

hi @Mariusz 

 

This solution gives me " 31/12/1899 09:00:00" so somewhere the date doesn't get passed. To make clear i want the date AND the time in full hours not only the correct time. Sorry if this wasn't made clear before.

Super User IV
Super User IV

Re: Last refresh datetime format to only display full hours

Hi @Johnlogistic 

 

Sure try this.

let
    DateTimeNow = DateTimeZone.UtcNow() + #duration(0, 2, 0, 0),
    TimePlus2 = #time( Time.Hour( DateTimeNow ), 0, 0 ),
    DateTimePlus2 = DateTime.Date( DateTimeNow ) & TimePlus2 
in
    DateTimePlus2
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors