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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
quikin5
Frequent Visitor

Generate a boolean column ifor the last hour

Hi, I have this streaming dataset (Assume current time is 10:50:00 AM)

TimeValuesLast hour
09:42:13 AM1No
10:24:56 AM-1Yes

How can I generate the last column? This dataset is refreshed every 30 minutes, so some values in this column change automatically whenever the data is refreshed.

Thanks!

1 ACCEPTED SOLUTION
AiolosZhao
Memorable Member
Memorable Member

Hi @quikin5 ,

 

Please try to use the below-calculated column, and it works on my desktop and you don't need to worry about the midnight issue I think.

 

Last Hour = IF(HOUR(Your_Time_Column + 1/24) = HOUR(NOW()),"Yes","No") 

 

Thanks.

Aiolos Zhao 





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @quikin5 

 

If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly.thanks!

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
AiolosZhao
Memorable Member
Memorable Member

Hi @quikin5 ,

 

Please try to use the below-calculated column, and it works on my desktop and you don't need to worry about the midnight issue I think.

 

Last Hour = IF(HOUR(Your_Time_Column + 1/24) = HOUR(NOW()),"Yes","No") 

 

Thanks.

Aiolos Zhao 





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

Proud to be a Super User!




az38
Community Champion
Community Champion

Hi @quikin5 

smth like

 

Last hour = 
IF(DATEDIFF([Time], TIME(), HOUR) < 2, "Yes", "No")

 

but it is going to produce issue at midnight level. you should define how it should work at 00:30 without Date column

as you asked for boolean better so

Last hour = 
IF(DATEDIFF([Time], TIME(), HOUR) < 2, TRUE(), FALSE())

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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