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 all, I'm struggling to pass a table field name as a parameter to a function.
I've tried several things but none worked.... this
DesiredField is the column in the table "tblFolder" I want to return a value from.
I'm sure it is simple but since I'm a novice....
//fxFieldContent
(Year as number, DesiredField as text) =>
let
aaa = DesiredField,
Source = tblFolder,
#"Filtered lines" = Table.SelectRows(Source, each ([Year] = Year) and ([Selection] = "X")),
//FieldContent = #"Filtered lines"{0}[Path]& #"Filtered lines"{0}[File] // Working but field in hardcoded
//FieldContent = #"Filtered lines"{0}{DesiredField} doesn't work
//FieldContent = #"Filtered lines"{0}[aaa] //doesn't work
//FieldContent = #"Filtered lines"{0}[#"Record.Field(_,DesiredField)"] //doesn't work
// By using [DesiredField], it is trying to find the field "DesiredField" in tblFolder, which does not exist!
//How can I change the [DesiredField] and use the parameter "DesiredField" to select my desired field?
FieldContent = #"Filtered lines"{0}[DesiredField]
in
FieldContent
Thank you for your help.
Solved! Go to Solution.
Hi @DanFromMontreal you were close 😉
Record.Field(#"Filtered lines"{0}, aaa)
or
Record.Field(#"Filtered lines"{0}, DesiredField)
Thank you so much dufoq3
Hi @DanFromMontreal you were close 😉
Record.Field(#"Filtered lines"{0}, aaa)
or
Record.Field(#"Filtered lines"{0}, DesiredField)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.