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))
marcelmunk
4 years agoFrequent Visitor
Now it looks great on the test query:
But it still givs me an error on the actual data:
The error msg is 'A cyclic reference was found during evaluation'
Vijay_A_Verma
4 years agoMost Valuable Professional
Let's try to do this through an Index column.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXIvSk3NA9LBGYlFBUDaFYiNTYBEBBAHFOUXGAFppVidaCUnIMMppzQVpDg3P78kA8jwBWIzcyARCVVtDFPtDGQEpaYASefSkpLMvHQgywOILSyBRBRUtSlYdSwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product Name" = _t, Prop1 = _t, Prop2 = _t, Prop3 = _t, Prop4 = _t, Prop5 = _t, #"Desired Property" = _t, Column1 = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Value", each Table.Column(#"Added Index",[Desired Property]){[Index]}),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"- marcelmunk4 years agoFrequent Visitor
Apparentlu it's working. Will test with more data. Thanks a lot.