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
wokka
Helper IV
Helper IV

Pass slicer value to a TSQL query to pull data from SQL Server

HI

 

I have a powerbi desktop that pulls data from both an existing powerbi model , and I also need to add data from a separate SQL Server data source.

 

I havent done this before - can I please confirm that if I add SQL Server as a data source, will I need to add a local model or not please?

 

Also - how do I pass a slicer value to some DAX code to then fire at SQL Server please? The TSQL would be something simple like :  

select * from Some_table 

 

I can obtain the slicer value easily enough with SELECTEDVALUE

 

Half of the problem is knowing how to set this all up. Assume we already have 2 existing connections - one to data warehouse semantic model and one to SQL Server.

 

Thanks in advance.

 

1 ACCEPTED SOLUTION
kushanNa
Super User
Super User

Hi @wokka 

 

Yes you can pass values from a slicer to SQL query but you need to have that query in direct query mode 

 

here is an example how to do it : https://www.youtube.com/watch?v=pXU_SpiBWUA&t=18s&ab_channel=DataPlatformCentral 

View solution in original post

4 REPLIES 4
kushanNa
Super User
Super User

Hi @wokka 

 

Yes you can pass values from a slicer to SQL query but you need to have that query in direct query mode 

 

here is an example how to do it : https://www.youtube.com/watch?v=pXU_SpiBWUA&t=18s&ab_channel=DataPlatformCentral 

Hi @wokka,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @kushanNa for the prompt response.

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the super user resolved your issue? or let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @wokka,

 

We wanted to kindly follow up to check if the solution provided by the super user resolved your issue.

If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @wokka,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the super user resolved your issue.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

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.