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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
smpa01
Community Champion
Community Champion

Assiginng Record Field Name Dynamically

Is it posible to assign the Record Field name dynamically.

I am currently getting an error.

let
  fieldName = {"a","b"},
  src=[fieldName{0}=1,fieldName{1}=2]
in
    src

 

smpa01_0-1673454402917.png

 

@AlexisOlson @CNENFRNL  @ImkeF 

 

Thank you in advance

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

How about this?

let
    fieldNames = {"a","b"},
    src=Record.FromList({1,2}, fieldNames)
in
    src

View solution in original post

3 REPLIES 3
smpa01
Community Champion
Community Champion

Thanks @AlexisOlson 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
AlexisOlson
Super User
Super User

Here's another method that's more in the spirit of your attempt but not at nice:

let
    fieldNames = {"a","b"},
    src=Record.Combine(
        {
            Record.AddField([],fieldNames{0},1),
            Record.AddField([],fieldNames{1},2)
        }
    )
in
    src
AlexisOlson
Super User
Super User

How about this?

let
    fieldNames = {"a","b"},
    src=Record.FromList({1,2}, fieldNames)
in
    src

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.