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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Mattula
Frequent Visitor

Next Occurrence of value

I have a table of events and I want in a card to retrieve the next event which has the status 'Planned'. 

 

My table looks like this 

 

DateStatusEvent
11/12/2023ConfirmedEvent 1
12/12/2023ConfirmedEvent 2
13/12/2023CancelledEvent 3
14/12/2023ConfirmedEvent 4
15/12/2023PlannedEvent 5
16/12/2023CancelledEvent 6
17/12/2023PlannedEvent 7
18/12/2023NEWEvent 8
19/12/2023NEWEvent 9
20/12/2023PlannedEvent 10

 

I have used this Measure which is retrieving a value but isn't the next occuring event in the date order from today's date 

 

 

Next Event =
CALCULATE(MIN(TABLE1[EVENT]),
FILTER(
    TABLE1,
    TABLE1[EVENT_STATUS] = "Planning" &&
    TABLE1[Date] >= NOW()
)
)
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Here's the measure I have: 

 

Next Event = 
var earliestPlannedDate = CALCULATE(MIN('Table'[Date]), 'Table'[Date] >= TODAY() && 'Table'[Status] = "Planned")
return CALCULATE(MIN('Table'[Event]), 
    FILTER(
        'Table',
        'Table'[Date] = earliestPlannedDate
    )
)

 

Just a quick note - the TODAY() and NOW() functions are based on UTC time, but you should be able to find many threads on here about converting to local time. 

 

And the reason that your measure didn't work is because the MAX([Event]) will grab the first event alphabetically, so between events 7 and event 10, the "1" would come before "7", resulting in the incorrect result you saw above.

 

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

Here's the measure I have: 

 

Next Event = 
var earliestPlannedDate = CALCULATE(MIN('Table'[Date]), 'Table'[Date] >= TODAY() && 'Table'[Status] = "Planned")
return CALCULATE(MIN('Table'[Event]), 
    FILTER(
        'Table',
        'Table'[Date] = earliestPlannedDate
    )
)

 

Just a quick note - the TODAY() and NOW() functions are based on UTC time, but you should be able to find many threads on here about converting to local time. 

 

And the reason that your measure didn't work is because the MAX([Event]) will grab the first event alphabetically, so between events 7 and event 10, the "1" would come before "7", resulting in the incorrect result you saw above.

 

This worked perfectly. Thank you 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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