Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Multi Column Relationships in the same table

Hi All,    First post, I have looked for a previous answer on this and havent found something that fits. I cant have multiple active relationships on the same table to multiple columns. I am tryin...
  • LivioLanzo's avatar
    LivioLanzo
    7 years ago

    try like this:

     

    let
    
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XY3LCQAxCER78ZyL31qSlfTfxo6ysCGDhyc+nExiGqTC5gGo2SNJAE8HMDsAFi2tBMW6Oqfw/SnBTuH/XycHiF6NcRWFeZ/2Cw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [UID = _t, A = _t, B = _t, C = _t]),
        
        ChangedType = Table.TransformColumnTypes(Source,{{"UID", Int64.Type}, {"A", type text}, {"B", type text}, {"C", type text}}),
        
        AddIDCol = Table.AddColumn( 
                            ChangedType, 
                            "ID",
                       each if 
                                [C] <> "" 
                            then 
                                [C]
                            else
                                if 
                                    [B] <> ""
                                then
                                    [B]
                                else
                                    [A],
                                type text
        )
                                
        
        
    in
        AddIDCol