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

Need Help with Correct Formatting

Hi all, 

 

I am having an issue when trying to run this power query. I have a query that converts my date time column, to military time (i.e. 13:00:00). I am trying to get this query to work, but it is giving me errors since I cannot use the operators that I have in the query.

 

= if [#"end_time (Time Only)"] >= "05:00:00" and [#"end_time (Time Only)"] < "17:00:00"
then "FAIL"
else "PASS"

 

shannanroberts_0-1652293157531.png

 

If anyone has advice on how correct my formatting so I am able to use these operators, that would be much appreciated!

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

A time will be 

#time(hour as number, minute as number, second as number)

 "05:00:00" is a string.

That should be enough to get you a little further 

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @shannanroberts ,

 

You could use Time.FromText() to convert String to Time type:

if [Time]>=Time.FromText("05:00:00") and [Time]<Time.FromText("17:00:00") then "FAIL" else "PASS"

Output:

Eyelyn9_0-1652684765931.png

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

A time will be 

#time(hour as number, minute as number, second as number)

 "05:00:00" is a string.

That should be enough to get you a little further 

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors