Forum Discussion
thmonte
Helper IV
8 years agoShow all records that touch a date range
I am trying to create a measure to use in my visuals that will filter all dates that cross a range. So I have one table that has start date & end date columns. I also have a Date Table with uniq...
- 8 years ago
Hey,
the problem that you have to tackle is called "events in progress", here you will find some readings that also provide solutions.
- https://blog.crossjoin.co.uk/2013/06/13/a-new-events-in-progress-dax-pattern/
- http://sqljason.com/2012/11/classifying-and-solving-events-in.html
- https://blog.gbrueckl.at/2014/12/events-in-progress-for-time-periods-in-dax/
and a whitepaper that describes the problem in much detail
Regards,
Tom
Anonymous
8 years agoNot applicable
your filter function is wrong. you were looking at < min date and more than max date. you needed to look at between the 2 dates
Count Rows =
VAR maxDate =
MAX ( 'Date'[Date] )
VAR minDate =
MIN ('Date'[Date])
RETURN
CALCULATE (
COUNTROWS ( Records ),
FILTER (
Records,
( Records[Start Date].[Date] >= minDate
&& Records[Fake End Date].[Date] <= maxDate )
)
)