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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
shuhn1229
Helper III
Helper III

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors