Forum Discussion
Filter active projects based on selected date range
- 4 years ago
Sorry I had my filters the wrong way round see if it's any better now? (Same link)
Project Filter = VAR EarliestVisibleDate = MIN ( 'Date'[Date] ) VAR LatestVisibleDate = MAX ( 'Date'[Date] ) VAR FilteredProjects = FILTER ( Project, Project[Finish] >= EarliestVisibleDate && Project[Start] <= LatestVisibleDate ) RETURN INT ( NOT ( ISEMPTY ( FilteredProjects ) ) )
Alternatively have a look at the second file on the same link. It uses power query to transform your table into a row per day per project:This has the advantage of just being able to use a straight relationship.
Hope it gives you some ideas!
So you have two main options.
First one is to leave your date table disconnected and do all the work in DAX.
Add a measure like:
Project Filter =
VAR EarliestVisibleDate = MIN ( 'Date'[Date] )
VAR LatestVisibleDate = MAX ( 'Date'[Date] )
VAR FilteredProjects =
FILTER (
Project,
Project[Start] >= EarliestVisibleDate && Project[Finish] <= LatestVisibleDate
)
RETURN INT ( NOT ( ISEMPTY ( FilteredProjects ) ) )
And use it as a visual filter set to 1:
My prefered option is to change the grain of your table so there is one row per day. I'll send an example shortly.
- Anonymous4 years agoNot applicable
The first option doesn't seem to work. I believe it does not apply to tasks that have their start/finish outside of the date range, which are also active projects.
- bcdobbs4 years ago
Community Champion
Sorry I had my filters the wrong way round see if it's any better now? (Same link)
Project Filter = VAR EarliestVisibleDate = MIN ( 'Date'[Date] ) VAR LatestVisibleDate = MAX ( 'Date'[Date] ) VAR FilteredProjects = FILTER ( Project, Project[Finish] >= EarliestVisibleDate && Project[Start] <= LatestVisibleDate ) RETURN INT ( NOT ( ISEMPTY ( FilteredProjects ) ) )
Alternatively have a look at the second file on the same link. It uses power query to transform your table into a row per day per project:This has the advantage of just being able to use a straight relationship.
Hope it gives you some ideas!
- Anonymous4 years agoNot applicable
I would have ideally implemented the first option, but seems to have a lot of limitations, especially when dealing with Months and multiple visuals. Eg. Projects that are Finishing before the end of the Month, but still need to be part of Active Projects.
However, the second example is working perfectly! There were too many columns in the actual table so I ended up creating a reference table with a bidirectional relationship for just the primary key and dates.
Thank you so much for your assistance!!