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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Hennadii
Helper IV
Helper IV

Power Query / M. Create a record with a parameterized field name

Hello experts,

 

I'm looking for a solution to create a record with a custom field name through a function.

I tried to use the following expression for CreateRecord function but it does not work properly.

 

(fieldName) =>
let
    rec = [fieldName = "some value"]
in
    rec

 

In a result, it returns a record with a field named fieldName.

CreateRecord.png

 

But I'm expecting that it returns a record named as the passed parameter in the function - SpecificFieldName.

Is there a way to do it?

 

Thank you in advance!

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Hennadii 

(fieldName) =>
let
    rec = Record.FromList({"some value"}, {fieldName})
in
    rec

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

1 REPLY 1
AlB
Community Champion
Community Champion

Hi @Hennadii 

(fieldName) =>
let
    rec = Record.FromList({"some value"}, {fieldName})
in
    rec

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.