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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
smpa01
Super User
Super User

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
Super User
Super User

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.