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
Anonymous
Not applicable

Offset 22 hours

Hi! How can I use DAX to offset 22 hours from data?

Thanks in advance!

 

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

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1638413784628.png

Here are the steps you can follow:

1. Create measure.

Falg =
var _22hours=NOW()-22/24
var _maxtime=MAXX(FILTER(ALL('Table'),HOUR([date])=HOUR(_22hours)&&DAY([date])=DAY(_22hours)),[date])
return
IF(MAX('Table'[date])=_maxtime,1,0)

2. Place [Flag] in Filter, set is =1, apply filter.

vyangliumsft_1-1638413784631.png

3. Result:

vyangliumsft_2-1638413784634.png

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1638413784628.png

Here are the steps you can follow:

1. Create measure.

Falg =
var _22hours=NOW()-22/24
var _maxtime=MAXX(FILTER(ALL('Table'),HOUR([date])=HOUR(_22hours)&&DAY([date])=DAY(_22hours)),[date])
return
IF(MAX('Table'[date])=_maxtime,1,0)

2. Place [Flag] in Filter, set is =1, apply filter.

vyangliumsft_1-1638413784631.png

3. Result:

vyangliumsft_2-1638413784634.png

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

Hi @amitchandak, thanks for responding.

I have a report that captures the latest record everytime it refreshes. What I need to do is to display the previous shift. It only gets viewed twice a day - once per shift, 5AM/5PM. Say, at 5PM today, I need to display the last record from 7PM the previous day where if it's 5AM, I need to display the last record from 7AM the previous day.

 

An alternative is to ensure that it's only refreshed with the database twice a day, maybe at 4:30 so that it's ready by 5. But I am wondering if there's a way that I could do it in DAX or Power Query.

 

Thank you!

amitchandak
Super User
Super User

@Anonymous , Can explain with example ?

 

If you need add time 

 

New column = [Datetime] +time(22,0,0)

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.