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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Lorenz33
Helper III
Helper III

Pass parameter in M query to retrieve data from SQL Server database

We are using Power BI Desktop for Report Server (May 2021). Within the query editor we are trying to create a query that retrieves data from an SQL Server database and have it filtered by a parameter. The parameter is "companyIds".

 

The query we are using is:

 

select COMPANY_ID as [Company Id], PUBLIC_COMPANY_ID as [Company Number]#(lf)from dbo.COMPANY where COMPANY_ID in(companyIds)

 

We are unable to get it to work. Please let us know if what we are trying to do is possible and if so what would be the solution.

1 REPLY 1
v-eqin-msft
Community Support
Community Support

Hi @Lorenz33 ,

Yes, you can call query parameter when you implement SQL statement in power bi, you can also refer to this:

https://www.biinsight.com/power-bi-desktop-query-parameters-part2-dynamic-data-masking-and-query-par...

https://reevessmith.wordpress.com/2014/08/19/power-query-and-stored-procedures-with-parameters/

Pass parameter to SQL Queries statement using Power BI

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors