Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Community
We have recieved a request to have following filter on a data set
1) Selected Company - User Choice
2) Company Cohort (Will be dynamically selected by User)
3) Classification of Companies (Predefined with associated companies)
4) All Companies Together.
Is it possible to pass all the filters in to a single visual. The team need to see a combined bar chart with 4 groups labelled as selected company, cohort, classification and all. Please suggest a possible approach.
Thanks
Solved! Go to Solution.
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 Community
Thanks for quick reponse. In my case all the filter have been created based on the individual independent tables which are then associated with main tables.
Selected Company, Cohort Company and Classification are independent filters.
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.
Hey @esingh ,
You can achieve this by creating dynamic measures with DAX and using filter context for each group. Use a slicer for the selected company, a dynamic filter for the cohort, predefined classifications in your data model, and an ALL() function for all companies. Combine these measures in a single bar chart, and use a SWITCH() or IF function in DAX to dynamically switch between the different groups based on the user's selection.
Measure = SWITCH( TRUE(), SELECTEDVALUE(Company[Name]) = "Selected Company", [Measure for Selected Company], SELECTEDVALUE(Cohort[Name]) = "Company Cohort", [Measure for Cohort], SELECTEDVALUE(Classification[Category]) = "Classification", [Measure for Classification], [Measure for All Companies] )
For Detailed Information:
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
Hi @esingh ,
This is absolutely achievable in Power BI using a combination of disconnected tables, field parameters, and DAX logic to create a unified visual with grouped bars for, use below DAX to create a disconnected table first:-
CompanyComparisonGroup =
DATATABLE(
"GroupType", STRING,
{
{"Selected Company"},
{"Cohort"},
{"Classification"},
{"All Companies"}
}
)
Make sure you have slicers for:
Company[CompanyName]
— for selected company
Cohort[CohortName]
— for selected cohort
Classification[ClassName]
— for group of companies
Create the Measure to Calculate Values per Group
CompanyGroupMeasure =
VAR SelectedGroup = SELECTEDVALUE(CompanyComparisonGroup[GroupType])
VAR SelectedCompany = SELECTEDVALUE(Company[CompanyName])
VAR SelectedCohort = VALUES(Cohort[CohortName])
VAR SelectedClass = VALUES(Classification[ClassName])
RETURN
SWITCH(
TRUE(),
SelectedGroup = "Selected Company",
CALCULATE([YourMetric], Company[CompanyName] = SelectedCompany),
SelectedGroup = "Cohort",
CALCULATE([YourMetric], FILTER(Company, Company[Cohort] IN SelectedCohort)),
SelectedGroup = "Classification",
CALCULATE([YourMetric], FILTER(Company, Company[Classification] IN SelectedClass)),
SelectedGroup = "All Companies",
CALCULATE([YourMetric]),
BLANK()
)
Use a bar chart.
Set the X-axis to CompanyComparisonGroup[GroupType]
.
Use CompanyGroupMeasure
as the value.
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
55 | |
55 | |
37 | |
30 |
User | Count |
---|---|
78 | |
64 | |
45 | |
43 | |
40 |