Forum Discussion

gauravnarchal's avatar
gauravnarchal
Post Prodigy
5 years ago
Solved

Matching Columns in 2 Tables

I have two tables as shown below. I want to validate and match the values from Product and category column of table 1 with Product and category column of Table 2 else it should return “Incorrect Valu...
  • amitchandak's avatar
    5 years ago

    gauravnarchal , Try the option

     

    new Measure = if(isblank(countx(filter(Table1, Table1[product] = max(Table2[product]) && Table1[Category] = max(Table2[Category])),Table2[Category])) ,"Incorrect Value", "Valid")

     

    new column = if(isblank(countx(filter(Table2, Table2[product] =Table1[product] && Table2[Category] =Table1[Category]),Table2[Category])) ,"Incorrect Value", "Valid")

  • Anonymous's avatar
    Anonymous
    5 years ago

    hi gauravnarchal

     

    I have created the required solution using check at the table level - see below for the steps to create the same 

    Note: You can hide the Key column from report view if you do not want users to see the same. 

     

    1. Create key column for Mapping table 

    Key = 'Mapping table'[Product] & "-" & 'Mapping table'[Category]
     
     
    2. Create key column in Data table
    Key = 'Data Entry Table'[Product] & "-" & 'Data Entry Table'[Category]
     
    3. Create relationship between the "Key" columns between both tables
     
    4. Create check column in Data table 
    Check = if ('Data Entry Table'[Key] = RELATED('Mapping table'[Key]) , "Valid", "Incorrect Value")
     
     
    5. Create a table visual with the required data

     

     

    Please mark the post as a solution if my comment helped with solving your issue. Thanks!