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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
richard_wylde
Helper IV
Helper IV

parameter controlled by slicer

Hello,

In Power Query I have a query which is successfully sourced from the following, where Parameter1 is currently set to '[Sales]'

 


= Sql.Database("SERVERNAME", "DBNAME", [Query="SELECT  [Client]#(lf)      ,sum(" & Parameter1 & ")  #(lf)  FROM [T Sales]#(lf)  group by [Client] "])


However I now wish to link Parameter1 to a Slicer containing  [Sales] and [Permium] , so as the query returns either Sales or Premium depending on which the user selects, is this possible ??

8 REPLIES 8
v-lid-msft
Community Support
Community Support

Hi @richard_wylde ,

 

If you are using the Import mode, even the parameter changed, it need to refresh the dataset to get the result based on the parameter. When using Import mode, it better to store all the rows based on all the value of slicer, then the report will be filtered by the slicer.

 

 

If you want to get the part of data based on the slicer, the fact table should be DirectQuery mode, then when the slicer changed, it will query different result based on it withough using parameter, please refer to this document: https://community.powerbi.com/t5/Power-Query/Using-parametre-in-url-rp/td-p/1084291

 


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-lid-msft , I wasn't aware of query string parameters, that's great. It appears this can filter the number of records, but I'm trying to filter the number of columns, so as to give the user a choice of columns to choice from in the report, would there be a way to do this ?

Hi @richard_wylde ,

 

The key is the storage mode of fact table, if the fact table is in Direct Query Mode, it will retrive data based on the slicers, filters,interactor,  or url string parameter(actually it is kind of page filter), so it is will automatically send query like select ... from ... where column A = ... and column B = ... , based on the silcers and filter user select.

 

But if the fact table is in import mode, the data will only refreshed when execute an on-demand refresh or scheduled refresh, it will also filter data by slicer or filter if you import all the data in (mean no query parameter applied in the query), it will not query the source to get newest data when slicer or filter changed.

 

So in conclusion, if you want to get the latest data and do not want to import all the data, you can try to put the fact table in Direct Query Mode, please refer to this document: https://docs.microsoft.com/en-us/power-bi/desktop-use-directquery


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
nandukrishnavs
Community Champion
Community Champion

@richard_wylde 

 

You cannot change the EditQuery parameters from the report.  You could bring sales and premium into Power BI and write a DAX measure to switch the column based on slicer selection.

 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Thanks for letting me know, I shall suggest it as a new feature

@richard_wylde that is always good, post ideas on idea forum but recommended to check if there is an existing idea and vote for that, more votes, more attention to the idea.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k , do you know if there is another way I could chop up the Select statement ?

parry2k
Super User
Super User

@richard_wylde at this point, you cannot pass slicer values to a power query parameter. 

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.