Forum Discussion

AnneMi's avatar
AnneMi
Frequent Visitor
3 years ago
Solved

Adding a column in a table with values from another table

Hi, 

I want to add a column in table 1 with true/false if the values from table 2 is the same as table 1. 

 

Table 1: 

 

 

Table 2: 

 

 

 

 

  • Hi AnneMi ,

     

    You just need to change the return values of IF function. For example, true->1, false->0, you can create a column as below.

    Column = 
    IF(RELATED('Table 2'[Column1])='Table 1'[number],1,0)

    Final output:

     

    Best Regards,
    Community Support Team _ xiaosun

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

3 Replies

  • v-xiaosun-msft's avatar
    v-xiaosun-msft
    Icon for Community Support rankCommunity Support

    Hi AnneMi ,

     

    According to your description, here is my solution.

    Firstly, please establish a relationship between two tables.

    Then you can create a calculated column using IF and RELATED function.

    Column = IF(RELATED('Table 2'[Column1])='Table 1'[number],TRUE(),FALSE())

    Final output:

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ xiaosun

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

  • AnneMi's avatar
    AnneMi
    Frequent Visitor

    Thank you very much! It worked. If I want to mark the values for 0 and 1 instead of true/false. What does this formula look like?

     

    • v-xiaosun-msft's avatar
      v-xiaosun-msft
      Icon for Community Support rankCommunity Support

      Hi AnneMi ,

       

      You just need to change the return values of IF function. For example, true->1, false->0, you can create a column as below.

      Column = 
      IF(RELATED('Table 2'[Column1])='Table 1'[number],1,0)

      Final output:

       

      Best Regards,
      Community Support Team _ xiaosun

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