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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Joshua_symons
Regular Visitor

Inserting a list of value into a Snowflake query

Hi,

 

I currently have a list of values which dynamically change either in value or length of list. E.g.

 

Kjn23409u

Nskjnfwo123

Slmdfwo10239

 

I then have another query which filters an extremely large database (Over 10 million rows) based on the above list of values.

 

SELECT *

FROM X_Database

WHERE ITEM_ID in (‘Kjn23409u’,’ Nskjnfwo123’,’ Slmdfwo10239’)

 

I currently have to update the list of values in the SQL whenever the original list updates, however I would like to have this done automatically using power query.

 

My question is it possible to place the first list of values generated from a query from an excel file into the snowflake sql query using the advance editor. E.g. Create a variable which reference another query (that is a list of value) and then place the variable in to the sql query.

 

Current Query

let

    Source = Value.NativeQuery(Snowflake.Databases("Warehouse","Warehouse"){[Name="Database"]}[Data], " SELECT * FROM X_Database WHERE ITEM_ID in (‘Kjn23409u’,’ Nskjnfwo123’,’ Slmdfwo10239’)” , null, [EnableFolding=true]),

in

    #"Table"

 

Idea

Let

    VAR Item_id_list = query1

    Source = Value.NativeQuery(Snowflake.Databases("Warehouse","Warehouse"){[Name="Database"]}[Data], " SELECT * FROM X_Database WHERE ITEM_ID in Item_id_list" null, [EnableFolding=true]),

in

    #"Table"

 

 

Thank you in advance

1 REPLY 1
lbendlin
Super User
Super User

an extremely large database (Over 10 million rows) 

In Power BI we call this "medium sized".

 

My question is it possible to place the first list of values generated from a query from an excel file into the snowflake sql query using the advance editor. 

Technically possible but you will need to test if your code still works in the service refresh (if applicable)

 

Your "idea"  is only halfway viable. 

 

let

    Item_id_list = Text.Combine(query1,"','"),

    Source = Value.NativeQuery(Snowflake.Databases("Warehouse","Warehouse"){[Name="Database"]}[Data], " SELECT * FROM X_Database WHERE ITEM_ID in ('" & Item_id_list & "')", null, [EnableFolding=true]),

in

    Source

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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