Forum Discussion
Direct Query with Parameter to SQL
- 4 years ago
I'm saying that you don't have to parameterize it yourself. With DirectQuery, Power BI will automatically query your SQL source using the filters you've applied as part of the query.
I'd recommend this article for more detailed information on DirectQuery:
https://radacad.com/directquery-connection-in-power-bi-how-does-it-work-limitations-and-advantages
I think this would be easier if you had a slicer where they could select a CustomerID rather than having to type it in. With DirectQuery this is similar to passing a parameter to a query but you don't have to do nearly as much work.
Thank you for your reply. I can definitely add a slicer for CustomerID. What I am trying to solve is how to pass that value to the direct query so that it only pulls back one customer's data in the SQL call. I do not want to bring over the entire customer transaction file because it would be enormous. Can you help me with having the SQL call only pull back one customer's data? AlexisOlson
- AlexisOlson4 years ago
Super User
Enforce single select on the slicer and it should only pull one.
- dkernen4 years ago
Resolver II
I am sorry, but I just don't understand. Here is a very simple sample file. (CustomerID = Referral_ID). How do I make the value of the slicer as my Referral and have my direct query use that as a parameter for the SQL call? AlexisOlson
https://mwtn-my.sharepoint.com/:u:/g/personal/dkernen_mwtn_org/ERhNpctEl3lCr47sFvB6fC0BG8l0B6ezoU4ZkQeJiWhhHQ?e=baWxXk- AlexisOlson4 years ago
Super User
I'm saying that you don't have to parameterize it yourself. With DirectQuery, Power BI will automatically query your SQL source using the filters you've applied as part of the query.
I'd recommend this article for more detailed information on DirectQuery:
https://radacad.com/directquery-connection-in-power-bi-how-does-it-work-limitations-and-advantages