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
-
Hi esingh,
Thank you for reaching out to the Microsoft fabric community forum.
Thank you grazitti_sapna, for your response regarding the Issue.
It is possible to show all four groups in one bar chart using a disconnected table and a DAX measure with SWITCH logic. Just create a table with "Selected Company", "Cohort", "Classification", and "All Companies" as group labels, and use it as the axis. Add slicers for Company, Cohort, and Classification so the measure calculates each group's value correctly based on user selection.
I tested it with my sample data, and it worked fine. Please find the attached screenshot and Pbix for your reference.
If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it
Best Regards,
Harshitha.