Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

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

 

mohd78_0-1711461403989.png

 

 

 

7 REPLIES 7
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

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" )

 

vkongfanfmsft_0-1711962773190.png

 

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
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" )
PhilipTreacy
Super User
Super User

@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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

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

 

mohd78_0-1712322554771.png

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
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
Not applicable

Yes. REGIS numbers column are a column in both tables

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.