Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
KateThePhoenix
Regular Visitor

Direct Query to SQL View: Time only column not able to bin.

I have a SQL Database that I'm working with, and person in charge of that has made a view for me, due to my need to have the date/time column split into Date and Time columns.

 

However, I can not create an hour bin for the time column (which PBI does recognizes as a Time column) which is what I need (right now it goes down to the second, not very helpful). It gives me this error:

2020-12-07 10_38_06-Window.jpg

So then I'm thinking maybe I can get away from just filtering things in the last 2 hours.

2020-12-07 10_40_53-Window.jpg

Again, I got an error, this time it looks like this:

2020-12-07 10_39_05-Window.jpg

So I reach out to the admin working on the database, thinking maybe the variable type is an integer, and that's why it's having issues, and he sends me this, saying he's confused as that value is definitely formated as Time:

2020-12-07 10_42_42-Zoetis - kmcclelland@phoenixlab.com - Outlook.jpg

 

Has anyone run into this before? Is this a formatting thing on my end or his end?

 

Additiotl Info: I do HAVE to be on a direct connect, as there are MILLIONS of rows of data in the database. I also can't share the report or database, as it has medical information in it that is sensitive.

5 REPLIES 5
Anonymous
Not applicable

In the query editor you can check the data type Power BI thinks it is. Click on the Transform tab then highlight your hour column. It should list the data type in the toolbar. If it's wrong, you can change it to Time and set the formatting you want. I had a similar thing happen with an experiment.

 

Aweptimum_1-1607367946789.png

 

Yeah, that was the first thing I checked, it does recognize the column as time.2020_12_07_11_13_46_Window111.jpg

Anonymous
Not applicable

I just whipped up a test page with some imported split date and time columns. The relative time slicer sounds like it should give similar behavior to your filter (they're advertised in the same place). I placed the time column into one and input 8 hours. The slicer looks like this:

Aweptimum_1-1607369487492.png

Looks identical to your filter range output. Since my data is a few months old, I just punched in 10,000 hours to see if there's more going on here though.

Aweptimum_0-1607369420200.png

You can see in this case it's actually subtracting time from the current date, not filtering by hourly bins. This is confirmed by the fact that my plot is displaying no data since there's no combined date/time column. I think this is corroborated by your second error message, since the filter could really be date/time, and it makes sense that filters and slicers use the same logic.

 

To be sure, I made a quick direct query mod in another report to grab date and time as separate columns, and the behavior is exactly the same with hour ranges before and after last midnight (although I'm not getting an error, just a blank plot in both cases).

 

It's hard to tell if it's actually filtering based on date/time behind the scenes, not time, when the range is less than a day, but the behavior seems to indicate it. That's frustrating. Might be a bug.

 

Also, found this from 3 years ago.

I did try the slicer, just to be thorough. I got the second error message again.

Hi @KateThePhoenix ,

 

Below reference may help:

https://docs.microsoft.com/en-us/dotnet/api/system.data.idbcommand?redirectedfrom=MSDN&view=net-5.0

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.