Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a table of client visits and visit dates (all future). There are multiple visit types that could be scheduled, but I would like to report what the next visit type is, not the when.
Here is a small sample:
| Patient Name | Visit Type | Visit Date |
| John Smith | Regular | 7/25/2024 |
| Betty Jones | Annual | 8/1/2024 |
| Bob Johnson | Regular | 7/10/2024 |
| John Smith | Annual | 8/25/2024 |
| Betty Jones | Regular | 9/1/2024 |
| Bob Johnson | Annual | 8/15/2024 |
For this example, I would like the results to look like this:
| Patient Name | Next Scheduled Visit Type |
| John Smith | Regular |
| Betty Jones | Annual |
| Bob Johnson | Regular |
I know how to calculate when the next visit is, but I don't know how to return the value in Visit Type based on that calculation.
Any and all help appreciated. Thank you
Solved! Go to Solution.
Hi @aflintdepm
Would a measure like this help?
Next Visit Type =
VAR _NextDate =
CALCULATE(
MIN( 'Table'[Visit Date] ),
'Table'[Visit Date] > TODAY()
)
VAR _NextType =
CALCULATE(
MAX( 'Table'[Visit Type] ),
'Table'[Visit Date] = _NextDate
)
RETURN
_NextType
Hi @aflintdepm
Would a measure like this help?
Next Visit Type =
VAR _NextDate =
CALCULATE(
MIN( 'Table'[Visit Date] ),
'Table'[Visit Date] > TODAY()
)
VAR _NextType =
CALCULATE(
MAX( 'Table'[Visit Type] ),
'Table'[Visit Date] = _NextDate
)
RETURN
_NextType
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 19 | |
| 17 | |
| 11 |