Forum Discussion
Anonymous
2 years agoNot applicable
Parameter as Search option
I have fetched data from an API. The data is about weather. It is giving me static location. But with the help of parameter i have made dimension dynamic. Now to change location every time i have to ...
bhanu_gautam
Super User
2 years ago- Create a new table in Power BI that contains the list of locations you want to use as parameters.
For example, you can create a table named Locations with a column LocationName. - Add a slicer visual to your report.
Set the slicer to use the LocationName column from the Locations table.
This will allow users to select a location from the dropdown list. - Go to the Home tab and click on Transform Data to open Power Query Editor.
Edit your query to use the selected value from the slicer. You can do this by creating a parameter in Power Query and setting its value based on the selected slicer value.
For example, you can create a parameter named SelectedLocation and set its value using a DAX expression like SELECTEDVALUE(Locations[LocationName])
Use the SelectedLocation parameter in your API query to fetch data for the selected location.
Anonymous
2 years agoNot applicable
This will give data for values present in table. How can i enter any city, state, country without creating new table
- Sergii242 years ago
Super User
Hi Anonymous, I think that with shared video and previous comments bhanu_gautam is highlighting the usefulness of lists to limit values that can be selected to make sure the query always returns a correct result.
If you want to provide the maximum flexibility, simply create 3 parameters of type text for city, state and country and alllow any value to be typed. However, you should be careful as a wrong value can be inserted (city with typo, non-existing country etc.)