Forum Discussion
marcelmunk
4 years agoFrequent Visitor
Retrieve value from same row based on column name in column
Hi, Pretty basic question (I believe) as I'm a beginner in Power BI and still on my basics on DAX. I have a Table which has the Product Name and many properties I want to add a new ...
- 4 years ago
Here's an alternative solution that reads the record itself:
= Table.AddColumn(Source, "Value", each Record.FieldOrDefault(_,[Desired Property], null))
AlexisOlson
4 years agoSuper User
I'd recommend a much simpler and more efficient approach.
Full sample query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXIvSk3NA9LBGYlFBUA6Aoid83Pyi5RidaKVnIA8p5zSVJCC3Pz8kgwgIxKIQ1IrSkqLUsFqnIH8oNQUkL7SkpLMvHQgKwqIfVJLSlKBxsQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product Name" = _t, Color = _t, Texture = _t, Letter = _t, #"Desired Property" = _t]),
#"Added Custom" = Table.AddColumn(Source, "Value", each Record.Field(_, [Desired Property]))
in
#"Added Custom"