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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Domenick
Helper IV
Helper IV

Lookup NEXT value in a series

I'm trying to find a solution for something that is actually really easy to do in Excel with VLOOKUP and should be doable in PowerBI DAX yet I haven't found any simple solution online.

 

I want to look up the next refresh time in a table based on the current time.

So I have one table "System Data Refresh" with the current time (and most recent refresh time):

 

Current Time |  Last Refresh Time
7:45               | 5:00

and another "Refresh Schedule" table with one column of values

Refresh Times
5:00
8:00
11:00
14:00
17:00
20:00

I want to create a column in System Data Refresh that looks up the next refresh time from the current time. So if the current time is 7:45, it would return 8:00. If the current time is 21:00 (after the last refresh time), it would return the first value.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Take the minimum time after the current time. If such a time doesn't exist, then take the earliest refresh time.

 

Next Refresh =
VAR CurrentTime = MAX ( System[Current Time] )
VAR NextRefresh =
    CALCULATE (
        MIN ( Refresh[Refresh Times] ),
        Refresh[Refresh Times] > CurrentTime
    )
RETURN
    IF (
        ISBLANK ( NextRefresh ),
        MIN ( Refresh[Refresh Times] ),
        NextRefresh
    )

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = coalesce(CALCULATE(MIN('Refresh Schedule'[Refresh Times]),FILTER('Refresh Schedule','Refresh Schedule'[Refresh Times]>EARLIER('System Data Refresh'[Current Time]))),min('Refresh Schedule'[Refresh Times]))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AlexisOlson
Super User
Super User

Take the minimum time after the current time. If such a time doesn't exist, then take the earliest refresh time.

 

Next Refresh =
VAR CurrentTime = MAX ( System[Current Time] )
VAR NextRefresh =
    CALCULATE (
        MIN ( Refresh[Refresh Times] ),
        Refresh[Refresh Times] > CurrentTime
    )
RETURN
    IF (
        ISBLANK ( NextRefresh ),
        MIN ( Refresh[Refresh Times] ),
        NextRefresh
    )

Omg yes that makes sense! I'll give it a shot. Thank you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors