Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
esingh
Helper I
Helper I

filter selection as group in single visuals

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

 

1 ACCEPTED 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

 

 

 

View solution in original post

6 REPLIES 6
esingh
Helper I
Helper I

thanks @grazitti_sapna @Nasif_Azam for the help

esingh
Helper I
Helper I

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

 

 

 

v-hjannapu
Community Support
Community Support

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.

vhjannapu_0-1750403316265.png

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.

 

 

Nasif_Azam
Super User
Super User

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:

Dynamic Measures in Power BI

DAX SWITCH Function

Using Filters in Power BI

ALL Function in DAX

 

 

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



Did I answer your question?
If so, mark my post as a solution!
Also consider helping someone else in the forums!

Proud to be a Super User!


LinkedIn
grazitti_sapna
Super User
Super User

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()
)

 

Build the Visual

  • 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!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.