The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am wanting to be able to filter differently for each different Project, at the parent level.
If I select Project1 in a slicer, I only want certain Task items to appear at the task level for that project in the Gantt Chart. I do not need all tasks to show up on the chart. For example, in Project1, there are Tasks 1-9. I only want Tasks 2,4,6 to show up on the chart.
Now, if I would switch to Project2, I want the related task items to show up in the Gantt Chart based off the filter specific to Project2. For example, Project2 has Tasks 1-15. I want Tasks 1,3,6,7,8 to show up on the Gantt.
The task level items for Project1 and Project2 are not the same and cannot have the same filters applied to them. I do not want the same task numbers to show up on the Gantt chart each time I switch to a different project.
Is there a DAX code that will filter tasks based off the Project that has been selected?
I was wondering if an IF statement or a SWITCH statement and paired with a FILTER statement, if any of those would work?
Hi @emilyh1 ,
Based on your description, you can indeed use a switch statement to accomplish your goal, as you can see in this dax example:
DynamicFilteredTasks = CALCULATE(
COUNTROWS(Tasks),
FILTER(
Tasks,
SWITCH(
SELECTEDVALUE(Projects[ProjectName]),
"Project1", Tasks[TaskID] IN {2, 4, 6},
"Project2", Tasks[TaskID] IN {1, 3, 6, 7, 8},
FALSE()
)
)
)
You can follow the above dax logic to create the dax you need, if you still can't solve the problem, please provide the pbix file, so that we can help you faster, please hide the privacy information in advance.
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
14 | |
14 | |
9 | |
7 |