Create parameter with suggested values from query of table column names

absherzad

New Member
Joined
Jun 19, 2017
Messages
42
Hello everyone,
Is it possible to create a parameter with the suggested values from the query that returns the column names from a table?

It seems Table.ColumnNames() returns the names of columns from a table as a text, because I don't see any drop-down list as an input value for the parameter.
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="MasterTable"]}[Content],
    #"Column Names" = Table.ColumnNames(Source)
in
    #"Column Names"

Even with suggested values from any it does not work. Any suggestions?

Regards,
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I just tried this and it worked fine for me.

When you are I the New Parameter wizard, and you selected your Query under "Suggested Values" do you not then see your query from the drop down? Sorry not very helpful answer I know.
 
Upvote 0
The M code works just fine. Also, the query is listed in the new parameter dialogue box. But

  • after the parameter is created, the drop-down list as input value does not appear.
  • also when I use this parameter inside the function as a place holder for the column name does not work.
I hope I could explain my concern.
 
Upvote 0
Hi everyone,
I found the solution and I would like to share it with others.
The solution is to use Record.Field() to allow a dynamic column name as a parameter inside the M language and it works like charm, as it is illustrated below :)

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="MasterTable"]}[Content],
    // #"Filter by Column" is the parameter for column names
    // #"Filter by Value" is another parameter for the value
    #"Filtered Rows by Parameters" = Table.SelectRows(Source, each Record.Field(_, #"Filter by Column") = #"Filter by Value")
in
    #"Filtered Rows by Parameters"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,735
Messages
6,132,420
Members
449,727
Latest member
Aby2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top