in Power BI / Power query, is it possible to put a list of value as parameter to another…
- User
in Power BI / Power query, is it possible to put a list of value as parameter to another query?
Assistant
Yes, it's possible to pass a list of values as a parameter to another query in Power BI/Power Query. There are a few ways to achieve this:
1. List Parameter and
List.Contains:This is the most common and generally preferred method.
-
Create a List Parameter: In the Power Query Editor, go to the "Manage Parameters" option in the "Home" tab and create a new parameter of type "List". You can then populate the list with the values you want to pass. Let's call this parameter
MyListParameter. -
Reference the Parameter in Another Query: In your second query, access the parameter using its name. You can then filter a table based on this list parameter using
List.Contains.
mlet Source = ..., // Your data source FilteredTable = Table.SelectRows(Source, each List.Contains(MyListParameter, [ColumnToFilter])) in FilteredTableThis code snippet filters the
Sourcetable, keeping only rows where the value inColumnToFilteris present in theMyListParameterlist.2. Table Parameter and
Table.Containsor Join:You can also pass a table containing the list of values as a parameter.
-
Create a Table Parameter: Create a new parameter of type "Table". This table should have a column containing the values you want to filter by. Let's call this parameter
MyTableParameterand the column with the valuesFilterColumn. -
Reference the Parameter and Filter/Join:
-
Using
Table.Contains:mlet Source = ..., // Your data source FilteredTable = Table.SelectRows(Source, each Table.Contains(MyTableParameter, [ColumnToFilter], "FilterColumn")) // Specify the column name in both tables in FilteredTable -
Using
Table.Join(More Efficient for Large Tables): Joining is generally more efficient than for large datasets.
-
-
- User
how to pass this parameter list into another query which is a DAX?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.