10. Parameters in Power Query (and Other Kinds of Parameters)
10.6 Using Parameters Elsewhere in M
In short: A parameter is simply a value, so you can use it anywhere in M.
A parameter is simply a value, so you can use it anywhere in M:
// in a conditional column value
each if [City] = SelectedCity then "Focus city" else "Other"
// in a text
each "Report for " & SelectedCity
// as a native SQL argument (keep it simple and trusted – avoid user-typed text)
Value.NativeQuery(Source, "SELECT * FROM dbo.vw_MaharashtraOrders WHERE City = @city",
[city = SelectedCity])
Ravindra Bagale's Tip
Friends, don't make a mistake here: common errors here are a type mismatch between the parameter and the column, renaming a parameter and breaking every query that uses the old name, and gluing a parameter into a web URL without RelativePath. Check Query Dependencies before renaming, and keep a static base URL. It's very simple – just make it a habit.
Ravindra Bagale's Tip – मराठी
मित्रांनो, इथे चूक करू नका: इथल्या common errors म्हणजे parameter आणि column मधला type mismatch, parameter rename करून जुनं नाव वापरणाऱ्या सगळ्या queries तोडणं, आणि RelativePath शिवाय parameter web URL ला चिकटवणं. Rename करण्याआधी Query Dependencies तपासा, आणि base URL static ठेवा. एकदम simple आहे, फक्त सवय लावून घ्या.
Ravindra Bagale's Tip – हिंदी
दोस्तों, यहाँ गलती मत करना: यहाँ की common errors हैं parameter और column के बीच type mismatch, parameter का नाम बदलकर पुराना नाम इस्तेमाल करने वाली हर query तोड़ देना, और RelativePath के बिना parameter को web URL में जोड़ देना. नाम बदलने से पहले Query Dependencies check करो, और base URL static रखो. बहुत आसान है, बस आदत बना लो.