Forum Discussion
Filter Multiple Columns with Hierarchy Slicer
- 1 year ago
Hi andre2x ,
I would like to suggest to follow below steps to get expected results.
Step1: Create HierarchyTable using below DAXHierarchyTable = UNION( SELECTCOLUMNS(Data, "Division", Data[Owner_Division], "Area", Data[Owner_Area], "Cohort", Data[Owner_Cohort]), SELECTCOLUMNS(Data, "Division", Data[Originator_Division], "Area", Data[Originator_Area], "Cohort", Data[Originator_Cohort]) )Step2: Create IsInScope measure for selected Division, Area and Chort. It ensures that whether the selected values are in scope or not.
IsInScope = Var SelectedDivision = SELECTEDVALUE(HierarchyTable[Division]) Var SelectedArea = SELECTEDVALUE(HierarchyTable[Area]) Var SelectedCohort = SELECTEDVALUE(HierarchyTable[Cohort]) Var Result = IF( -- Check if Division is selected and matches either Owner or Originator ( ISBLANK(SelectedDivision) || MAX(Data[Owner_Division]) = SelectedDivision || MAX(Data[Originator_Division]) = SelectedDivision ) && -- Check if Area is selected and matches either Owner or Originator ( ISBLANK(SelectedArea) || MAX(Data[Owner_Area]) = SelectedArea || MAX(Data[Originator_Area]) = SelectedArea ) && -- Check if Cohort is selected and matches either Owner or Originator ( ISBLANK(SelectedCohort) || MAX(Data[Owner_Cohort]) = SelectedCohort || MAX(Data[Originator_Cohort]) = SelectedCohort ), 1, -- Show row if conditions match 0 -- Hide row otherwise ) RETURN ResultStep3: Add the Division, Area and Chort values to the visual and add IsInScope to the filter pane and set the value is 1.
By using above approach you will get the desired output. Also I am attching .pbix file for your reference.
https://drive.google.com/file/d/1LMc_P0aEqhC7VpNntRFlkPmZqP8jZIZk/view?usp=drive_link
Thanks,If the solution helps, please Like👍 and mark it as Accepted Solution✅ so it may help others, if anyone facing same questions/issues.
Hi andre2x ,
I would like to suggest to follow below steps to get expected results.
Step1: Create HierarchyTable using below DAX
HierarchyTable =
UNION(
SELECTCOLUMNS(Data, "Division", Data[Owner_Division], "Area", Data[Owner_Area], "Cohort", Data[Owner_Cohort]),
SELECTCOLUMNS(Data, "Division", Data[Originator_Division], "Area", Data[Originator_Area], "Cohort", Data[Originator_Cohort])
)Step2: Create IsInScope measure for selected Division, Area and Chort. It ensures that whether the selected values are in scope or not.
IsInScope =
Var SelectedDivision = SELECTEDVALUE(HierarchyTable[Division])
Var SelectedArea = SELECTEDVALUE(HierarchyTable[Area])
Var SelectedCohort = SELECTEDVALUE(HierarchyTable[Cohort])
Var Result =
IF(
-- Check if Division is selected and matches either Owner or Originator
(
ISBLANK(SelectedDivision) ||
MAX(Data[Owner_Division]) = SelectedDivision ||
MAX(Data[Originator_Division]) = SelectedDivision
) &&
-- Check if Area is selected and matches either Owner or Originator
(
ISBLANK(SelectedArea) ||
MAX(Data[Owner_Area]) = SelectedArea ||
MAX(Data[Originator_Area]) = SelectedArea
) &&
-- Check if Cohort is selected and matches either Owner or Originator
(
ISBLANK(SelectedCohort) ||
MAX(Data[Owner_Cohort]) = SelectedCohort ||
MAX(Data[Originator_Cohort]) = SelectedCohort
),
1, -- Show row if conditions match
0 -- Hide row otherwise
)
RETURN
ResultStep3: Add the Division, Area and Chort values to the visual and add IsInScope to the filter pane and set the value is 1.
By using above approach you will get the desired output. Also I am attching .pbix file for your reference.
https://drive.google.com/file/d/1LMc_P0aEqhC7VpNntRFlkPmZqP8jZIZk/view?usp=drive_link
Thanks,
If the solution helps, please Like👍 and mark it as Accepted Solution✅ so it may help others, if anyone facing same questions/issues.
- andre2x1 year agoFrequent Visitor
This is working for me, thank you very much! Is there a workaround to applying this as a page-level filter? Currently I am applying IsInScope = 1 individually to each visual.