Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Compare values for multiple columns which may change dynamically

OwenAugerhelped me solve this problem for comparing values between four columns (A, B, C & D) with a scoring system on the pairs that matched. Each of these lettered columns represents a project name...
  • ThxAlot's avatar
    2 years ago

    Easy enough,

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYmMgNgFiU6VYHYgoMjYBi5pA1RpBRYFqYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t, E = _t]),
        #"Added Column" = Table.AddColumn(Source, "Score", each List.Sum(let l = Record.ToList(_), len = List.Count(l) in List.TransformMany({0..len-1}, each List.Skip(l, _+1), (x,y) => if l{x} = y then 1 else 0)))
    in
        #"Added Column"