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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
shuhn1229
Resolver I
Resolver I

Storing and reusing a value as a variable/parameter for other queries

Hi all,

 

Can someone let me know if I am approaching this problem from the right angle?

 

I have an excel sheet that contains a particular value in a specific cell that gets updated somewhat infrequently. I need to store this value as a variable and pass it to a few other independent queries that call an API, so that those APIs can fetch the right data contingent on this value. I want this all to happen automatically upon scheduled refresh so that when the result of that cell is first updated, it gets passed to the other queries so that they can pull the right data.

 

What I did was leverage the following code to create a one column list:

 

let
    Source = Excel.Workbook(Web.Contents("https://myurl.com/Token.xlsx")){[Name="myParameter"]},
    Data = Source[Data],
    Column1 = Data[Column1]
in
    Column1

 

Then I created a new parameter, selected "from query", & referenced the list generated by this query. The problem I am running into is that when I update the value in the spreadsheet, I have to manually select the new parameter in PBI desktop (edit parameters) to update that parameter, which will then flow to the other queries. Again, the idea is that when that value is updated, I store it as a variable and then patch it to all the other queries that would happen downstream of it. Am I thinking about this the right way?

 

Thanks

1 ACCEPTED SOLUTION
watkinnc
Super User
Super User

You can just filter the query for the Excel data to just a list, and then instead of making a proper "parameter" from the GUI, just refer directly to the query as the list parameter. So if the query with your list from Excel is named "FilterList", then your other queries can use it as a parameter like:

 

let Source = SomeTable

ApplyList = Table.SelectRows(Source, each List.Contains(List.Buffer(FilterList), [ColumnNameBeingFiltered]))

 

--Nate

 

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

You can just filter the query for the Excel data to just a list, and then instead of making a proper "parameter" from the GUI, just refer directly to the query as the list parameter. So if the query with your list from Excel is named "FilterList", then your other queries can use it as a parameter like:

 

let Source = SomeTable

ApplyList = Table.SelectRows(Source, each List.Contains(List.Buffer(FilterList), [ColumnNameBeingFiltered]))

 

--Nate

 

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Hi,

If I do this I get the following error: Formula.Firewall: Query ‘____’ (step ‘____’) references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

Is there anyway around this?

Thx

figured it out, ignore privacy. 

 

shuhn1229_0-1700172575531.png

 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.