Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello everybody,
I am currently trying to feed the List.Range function with parameters via a custom function, which sadly does not seem to be working.
The custom functions extract a value from the following spreadsheet table:
The custom function looks like this:
(ParameterName as text) =>
let
ParamSource = Excel.CurrentWorkbook(){[Name="tblParameter"]}[Content],
ParamRow = Table.SelectRows(ParamSource, each ([Parameter]=ParameterName)),
Value=
if Table.IsEmpty(ParamRow)=true
then null
else Record.Field(ParamRow{0},"Value")
in
Value
The custom function returns the correct result:
Yet when I insert the value returned by the custom function into the following formula, things go south:
= Table.SelectColumns(Source,List.Range(Table.ColumnNames(Source),0,14))
= Table.SelectColumns(Source,List.Range(Table.ColumnNames(Source),0,fnGetColumn("Submitted Forms: to Column")))
I am getting this error:
If I were to use a Power Query parameter, though, the List.Range function would accept it. But I need to extract the value from the spreadsheet.
Hope someone can help me out here!
Best regards!
This is what my Power Query privacy settings look like:
Where are the other privacy settings I am supposed to compare this with?
Where do I see the settings for the main datasource? Btw, the main source is a Files from Folder query.
Hi @Anonymous
Can this be the reference to a data files folder one line above the Excel workbook? Otherwise, you may be able to find it in the Global list (switch at the top of the Dialog window).
Kind regards,
JB
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |