Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a table of appointments that fall into 2 categories- Confirmed or Unconfirmed. For each Unconfirmed, there is a reason. I need to return the reason based on only the most recent unconfirmed appointment. I can calculate when the most recent unconfirmed appointment was, but I can't figure out how to return the reason.
Data
| Appointment Date | Status | Reason | |
| 5/1/24 | Confirmed | ||
| 6/1/24 | Unconfirmed | Cancelled | |
| 7/1/24 | Unconfirmed | No Show |
My formula for most recent unconfirmed date would be:
Most Recent = CALCULATE(MAX('Table'[Appointment Date]), 'Table'[Status]="Unconfirmed", 'Table'[Appointment Date]<=TODAY()
Using the data sample above, I would get 7/1/24 as my result. Now, how do I get "No Show"?
Thank you in advance for any help
Solved! Go to Solution.
hello @aflintdepm
your DAX looks good. If you want to get 'Reason' value, just use your DAX but change value inside MAX from date into reason.
Most Recent Reason = CALCULATE(MAX('Table'[Reason]), 'Table'[Status]="Unconfirmed", 'Table'[Appointment Date]<=TODAY())
Hope this will help you.
Thank you.
or try to plot a table visual with date column, status column and a measure like:
Measure =
VAR _currentdate = MAX(data[date])
VAR _statuspre =
MAXX(
TOPN(
1,
FILTER(ALL(data), data[date]<_currentdate),
data[date]
),
data[status]
)
VAR _result =
SWITCH(
_statuspre,
"Confirmed", "Cancelled",
"Unconfirmed", "No Show",
""
)
RETURN _result
it worked like:
Hi @aflintdepm ,
not sure if i fully get you, try to add a calculated column like:
column =
VAR _currentdate = [date]
VAR _statuspre =
MAXX(
TOPN(
1,
FILTER(data, data[date]<_currentdate),
data[date]
),
data[status]
)
VAR _result =
SWITCH(
_statuspre,
"Confirmed", "Cancelled",
"Unconfirmed", "No Show",
BLANK()
)
RETURN _result
it works like:
hello @aflintdepm
your DAX looks good. If you want to get 'Reason' value, just use your DAX but change value inside MAX from date into reason.
Most Recent Reason = CALCULATE(MAX('Table'[Reason]), 'Table'[Status]="Unconfirmed", 'Table'[Appointment Date]<=TODAY())
Hope this will help you.
Thank you.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 14 | |
| 8 | |
| 8 | |
| 8 |