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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
solarnstorage
Regular Visitor

Parameters setting other parameters

Hi,

 

I want to show specific weather data for one city at a time, among a list of different cities, as requested by the user. The data grab works through a URL that has a numerical code for a specific city. I have parameterized the data grab with these numerical codes, where I can choose which numerical code gets fed to the URL link. However, I want to be able to let the user make a selection based on city name (ex. New York, which has a specific associated numerial code), and that to set the numerical value parameter that feeds into the data grab.

 

Wondering if that's possible?

 

Thank you!

1 ACCEPTED SOLUTION

You must be quite close because haven't you already edited your M code to append the number (which is in the parameter) to the URL?

 

You then have to add a line before 'Source = ..... ' in the advanced editor of your query which creates a new variable, something like           CityNo = if CityParameter = "Webster" then "4954677" else if CityParameter = "Mayer" then "5036896"

 

You then use CityNo in the URL which gets assigned in the 'Source =' line.

View solution in original post

4 REPLIES 4
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @solarnstorage,

Could you please offer me some sample data and post your desired result if possible?

 

Regards,

Daniel He

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

I think HotChilli has the right idea, I'm trying to figure out how to do that.

 

My table looks like this:

 

Untitled.png

 

The parameter I want the user to be able to filter the data with is the city name: Webster or Mayer. But the value I have to pass to as a parameter to the URL is the numerical code (4954677 for Webster). I don't know how to connect that together.

 

Thanks!

 

 

You must be quite close because haven't you already edited your M code to append the number (which is in the parameter) to the URL?

 

You then have to add a line before 'Source = ..... ' in the advanced editor of your query which creates a new variable, something like           CityNo = if CityParameter = "Webster" then "4954677" else if CityParameter = "Mayer" then "5036896"

 

You then use CityNo in the URL which gets assigned in the 'Source =' line.

HotChilli
Super User
Super User

Should be possible, I think.  Set up the parameter to pick from a list of cities instead of codes (which presumably you are doing at the moment) If you write M code to translate the value of the parameter from the city to a numerical code, then append the code to the URL.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.