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 column of table 1 with Product column of Table 2 else it should return “Incorrect Value”.   Instead of creatin...
  • AllisonKennedy's avatar
    5 years ago
    Is there a relationship between the tables? If not, you can use something like:

    IF( SELECTEDVALUE(Table1[Product]) IN VALUES(Table2[Product]), "valid", Incorrect")
  • SteveCampbell's avatar
    5 years ago

    You can try

    Measure = 
    var _sv = RIGHT(SELECTEDVALUE(Table1[Ref ID]),2)
    VAR _LU = Calculate( FIRSTNONBLANK(  Table 2[Category],0 ) , Table 2[Product] = _sv )
    var _CV = Table1(ProductCategory)
    
    RETURN
    
    IF ( _LU = _SV, "Valid", "Incorrect Value" )