Forum Discussion
Measure Filtered by Date > Today()
For some reason DAX is much less intuitive than SQL to me.
I am trying to count up all future appointments.
Visits
| VisitKey | VisitDateKey | VisitTypeKey |
| 1 | 20221030 | 101 |
| 2 | 20221018 | 102 |
| 3 | 20221121 | 103 |
VisitType
| VisitTypeKey | VisitTypeName |
| 101 | New Client |
| 102 | Maintenance |
Date
| DateKey | DateValue (Date) | WeekYear |
| 20221011 | 10/15/2022 12:00:00 AM | 202241 |
| 20221012 | 10/16/2022 12:00:00 AM | 202241 |
Relationships:
Visits.VisitTypeKey = VisitType.VisitTypeKey
Date.DateKey = Visits.VisitDateKey
I am trying to only count up Visits that happen after today. My current measure is:
4 Replies
- johnt75Super User
Try
Future appointments = CALCULATE ( COUNTROWS ( Visits ), 'Date'[DateValue] >= TODAY () )- spencercwNew Member
This did not work. Similar to my solution, when I put it into a line chart, every future week shows the exact same values.
My Date table is marked as an official date table. Does that affect this?
- johnt75Super User
The code I posted is overwriting the filter from the chart. Try
Future appointments = CALCULATE ( COUNTROWS ( Visits ), KEEPFILTERS('Date'[DateValue] >= TODAY () ) )
- v-xiaotangCommunity Support
Hi spencercw
Thanks for reaching out to us.
I just want to confirm if you resolved this issue? If yes, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.
If you need more help, please let me know.
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.