Forum Discussion
New Column or New Measure
- 2 years ago
This doesn 't seem to need a measure. Even a calculated column is overkill. Much simpler to do in Power Query.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZcwxDoAgDIXhuzAz0FJURmXXxLAR7n8NS0mgxIUmXx5/KeY01uQ3Ax9wptou6bn5xTiAJ9gmi3g+O2ohPh5ErhlGN6SHIegJ/j61MC3SwuBF0gwHGtLDtOmJhKOWFsZDi4T5V/0A", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Parameter = _t, Treatment = _t, Score = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Parameter", type text}, {"Treatment", type text}, {"Score", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "New_Column", (k)=> Table.SelectRows(#"Changed Type",each [Parameter]=k[Parameter] and [Treatment]="CON")[Score]{0},Int64.Type) in #"Added Custom"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".
My very first question, new to Power Bi. I am trying to find the way to create new measure or new column called "NewProduct" using text values from the existing column. So I tried to use simple If statement to select yellow values and name them "ProductA", and select several other blue highlighted values as "ProductB", and ignore the rest of the values in the existing column, but could not find dax expression for it. So what is the best way to use these parameters from my existing column to create new values in a new column. Much apprecite any help.