Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Compare two columns in two different tables

I have two tables. one called purchase request and the other called registration

 

on the purchase request, i have a column called invoice total. and on the regis table column called Regis total.

 

i would like to create a calculated column to see if both columns are matched or not 

 

if matched I wanted to say yes if not I wanted to say no.

 

tried several formula but it didn't work

 

 

 

 

7 Replies

  • Anonymous 

     

    How can you identify a Purchase Request in the registratons table?

     

    Is there some value in both tables that can be linked?  A Purchase Request number?  Some kind of ID for the record?

     

    Phil

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes. REGIS numbers column are a column in both tables

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes I have a column called Pnumber . and the relation between them is many to many. I always get this error

       

      The column 'Logistics Center Report[RETAILTOTAL]' either doesn't exist or doesn't have a relationship to any table available in the current context.

       

      First table named Logistic center report and the second called regis

      is there anayway to solve this to get true or false when the numbers dosenot match?

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        I used this formula

        Compare Totals = IF(RELATED('Logistics Center Report'[RETAIL TOTAL])='REGIS'[REGIS TOTAL],TRUE(),FALSE())
         
        And I got an error
         
        The column 'Logistics Center Report[RETAIL TOTAL]' either doesn't exist or doesn't have a relationship to any table available in the current context.
         
        Not sure what to do 
         
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    The relationship between the two tables is established through the REGIS field and then the related function is used. The reference is as follows:

    Column =
    VAR COL_ =
        RELATED ( Registration[Regis Total] )
    RETURN
        IF ( 'Purchase Request'[Invoice Total] = COL_, "Yes", "no" )

     

     

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      i got thei error

       

      The column 'Logistics Center Report[RETAILTOTAL]' either doesn't exist or doesn't have a relationship to any table available in the current context.

       

      I used this as you stated

       

      Column =
      VAR COL_ =
          RELATED ( 'Logistics Center Report'[RETAILTOTAL] )
      RETURN
          IF ( 'REGIS'[REGIS TOTAL] = COL_, "True", "False" )
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    What does your data model look like and is it possible to provide some test data?

     

    Best Regards,
    Adamk Kong