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

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

Reply
gdijim
New Member

How to build an SQL based report, with slicers, and show tables based on slicer selection

Hi everyone, 

I'm brand new to PowerBI, and I may be thinking about this problem incorrectly, so if there's a better way to think about this, please let me know.

I have an MySQL server DB that I can query from PowerBI.  I need to provide a list of companies that I need to represent as slicer radio buttons to select the company.  I've figured out how to query the DB, and pull a list of companies, but I haven't been able to figure out how to apply the selected company as a parameter for the rest of the SQL queries that I need to present the data in other tables in the report.

I need all the tables in my report to show their queries based on that provided company parameter.

I've tried a variety of ways to do this, using measures, but it doesn't look like measures can apply to an SQL query as a parameter.

I'm unsure if this is a matter of needing to structure my database differently, or if I'm just not thinking correctly about how to use PowerBI.

Any help is appreciated.

Thanks!

-Jim Bentley


1 REPLY 1
marcelsmaglhaes
Super User
Super User

Hey @gdijim ,

 

In Power BI, when dealing with filters, it's often more efficient to create dimensions table rather than trying to filter by a parameter directly in your SQL queries. This approach simplifies your data modeling and provides a more robust solution for your reporting needs.

 

Here's a step-by-step guide to help you implement this:

 

1. Create a Company Dimension Table:

In Power Query, build a new table that contains a unique list of all the companies in your data. This will be your "Company" dimension table.


2. Define Company Attributes:

Include columns in your Company table for the company name and any additional attributes or information you may need for analysis.


3. Establish Relationships:

In the Power BI model view, establish relationships between your Company table and the corresponding columns in your fact tables (e.g., Sales, Orders) based on the 'Company' column. Ensure you set the appropriate cardinality and cross-filter direction.


4. Create a Slicer:

Develop a slicer visual in your report and connect it to the 'Company' field in your Company dimension table.


5. Filtering by Selection:

When you select a company from the slicer, it will automatically filter the data in your fact tables, making it a central filter for all your data.

 

This approach streamlines your data model, simplifies filtering, and enhances report performance. It's especially beneficial when dealing with extensive datasets and complex data relationships.

By implementing a Company dimension table, you're creating a more structured and effective solution for your Power BI reporting.

If this post helps, please mark as solved. 

Best regards,
Marcel


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.