Forum Discussion
filter selection as group in single visuals
- 1 year ago
Hi esingh,
Thanks for the clarification — since your Selected Company, Cohort, and Classification filters are coming from independent tables, the approach still works — you just need to make sure your DAX measure properly pulls selections from those disconnected filters and applies them against your main fact table via relationships or logic.
Create Disconnected Comparison Group Table
CompanyComparisonGroup =
DATATABLE(
"GroupType", STRING,
{
{"Selected Company"},
{"Cohort"},
{"Classification"},
{"All Companies"}
}
)Create Your Metric Measure (Assuming measure Total Revenue)
TotalRevenue = SUM('FactTable'[Revenue])
Now define the unified logic using your disconnected slicers:
CompanyGroupMeasure =
VAR SelectedGroup = SELECTEDVALUE(CompanyComparisonGroup[GroupType])
VAR SelectedCompany = SELECTEDVALUE('SelectedCompany'[CompanyName])
VAR SelectedCohort = VALUES('Cohort'[CompanyName])
VAR SelectedClass = VALUES('Classification'[CompanyName])RETURN
SWITCH(
TRUE(),
SelectedGroup = "Selected Company",
CALCULATE([TotalRevenue], 'FactTable'[CompanyName] = SelectedCompany),SelectedGroup = "Cohort",
CALCULATE([TotalRevenue], 'FactTable'[CompanyName] IN SelectedCohort),SelectedGroup = "Classification",
CALCULATE([TotalRevenue], 'FactTable'[CompanyName] IN SelectedClass),SelectedGroup = "All Companies",
[TotalRevenue]
)-
Axis:
CompanyComparisonGroup[GroupType] -
Value:
CompanyGroupMeasure -
Optional Tooltip: Add
[TotalRevenue]as well for raw value view
-
thanks grazitti_sapna Nasif_Azam for the help