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

{Direct Query} Change to Timeformat and Rounddown to nearest.

hi everyone,

I have an data output in my sql table in number format, when trying to calcuate the differentiate output comes in number format but output required is below.

 

11.35 to 11:21 and should rounddown to 11:00

11.65 to 11:39 and should rounddown to 11:30

12:00 to 12:00 and should not rounddown to 12:00

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: "Direct Query" Switch to Time Format and Round to Nearest.

Hello @askspepsi ,

If I got your logic correctly, try the following forms in new columns:

Half hour = 
ROUND('Table'[Value] / 24 * 48,0) / 48 

Desired Output = 
IF(
    MINUTE('Table'[Value] / 24) <= 30 , 
    ROUND('Table'[Value] , 0 ) / 24 , 
    ROUND('Table'[Value] / 24 * 48 , 0 ) / 48
)

10-08-_2020_17-27-03.png

Greetings FrankAT

View solution in original post

4 REPLIES 4
Highlighted
Super User IX
Super User IX

Re: {Direct Query} Change to Timeformat and Rounddown to nearest.

@askspepsi , check if you can create a column suggested in this post

https://community.powerbi.com/t5/Desktop/Round-up-time-to-next-hour/td-p/701404



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Helper I
Helper I

Re: {Direct Query} Change to Timeformat and Rounddown to nearest.

@amitchandak 

this is in time format where i cann't change.

Highlighted
Super User II
Super User II

Re: "Direct Query" Switch to Time Format and Round to Nearest.

Hello @askspepsi ,

If I got your logic correctly, try the following forms in new columns:

Half hour = 
ROUND('Table'[Value] / 24 * 48,0) / 48 

Desired Output = 
IF(
    MINUTE('Table'[Value] / 24) <= 30 , 
    ROUND('Table'[Value] , 0 ) / 24 , 
    ROUND('Table'[Value] / 24 * 48 , 0 ) / 48
)

10-08-_2020_17-27-03.png

Greetings FrankAT

View solution in original post

Highlighted
Helper I
Helper I

Re: "Direct Query" Switch to Time Format and Round to Nearest.

@FrankAT

sorry for the late reply,

Thanks for the update. this is the extact output i required.

regards

askspepsi

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors