Forum Discussion

NMahi1703's avatar
NMahi1703
Frequent Visitor
3 years ago
Solved

Filtering Data in Another Table which has the relationship with One table with Mutiple Conditions

Hi Team, I Have One table Name Table_1 below  Account ID ID 9484 1811 9484 3291 9484 4691 Another Table as Table_2 Account Number BilliD Name 9484 1811 P1 9484 32...
  • Anonymous's avatar
    Anonymous
    3 years ago

    HI NMahi1703,

    You can create a new table with crossjoin function with table 1 field and table 2 Name fields, then add a filter to remove not match records based on the raw table records mapping.

    Expand = 
    VAR idList =
        CALCULATETABLE (
            VALUES ( Table2[BilliD] ),
            FILTER ( Table2, [BilliD] <> "NA" )
        )
    VAR mapping =
        SELECTCOLUMNS (
            FILTER ( Table2, [BilliD] <> "NA" ),
            "Merged",
                [Account Number] & "-" & [BilliD] & "-" & [Name]
        )
    RETURN
        FILTER (
            CROSSJOIN ( Table1, VALUES ( Table2[Name] ) ),
            IF (
                [ID] IN idList,
                [Account ID] & "-" & [ID] & "-" & [Name] IN mapping,
                TRUE ()
            )
        )


    Regards,

    Xiaoxin Sheng