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
NoobAnalyst01
Helper I
Helper I

How to filter days in query editor to make N hours before current day

Hello,

 

I am trying to build a dashboard for our ops team.

 

I want to filter by Delivery date=Trunc(sysdate-3/24), becasue i want to the dashboard still return previous's data even people refreshh it at 2am in midanight, so I can you achieve this goal in PowerBi Query Editor?

 

Image 1.jpg

Thanks

Frank

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi
“How to filter days in query editor to make N hours before current day”
You could use function DateTime.IsInPreviousHour to indicate whether the given datetime value occurs during the previous number of hours, as determined by the current date and time on the system.
For example, the formula below determine if the hour before the current system time is in the previous two hours.
DateTime.IsInPreviousNHours(DateTime.LocalNow() - #duration(0,2,0,0), 2)
 
“becasue i want to the dashboard still return previous's data even people refreshh it at 2am in midanight”
You want get the previous's data displaying on dashboard after people refresh it, right?
I test but can’t find a feature to get this. You could see history of refresh only.
 
 
 
Best Regards
Maggie

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi
“How to filter days in query editor to make N hours before current day”
You could use function DateTime.IsInPreviousHour to indicate whether the given datetime value occurs during the previous number of hours, as determined by the current date and time on the system.
For example, the formula below determine if the hour before the current system time is in the previous two hours.
DateTime.IsInPreviousNHours(DateTime.LocalNow() - #duration(0,2,0,0), 2)
 
“becasue i want to the dashboard still return previous's data even people refreshh it at 2am in midanight”
You want get the previous's data displaying on dashboard after people refresh it, right?
I test but can’t find a feature to get this. You could see history of refresh only.
 
 
 
Best Regards
Maggie

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.