Ravindra BagaleCourses & study guides

10. Parameters in Power Query (and Other Kinds of Parameters)

10.6 Using Parameters Elsewhere 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

Mitrano, ithe chuk karu naka: 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. Ekdum simple aahe, fakt savay lavun ghya.