Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculated column on a table based on two columns from a different table

Hi Gurus, 

 

I have  requrirment that I struggel,

 

I have two tabels (Table 1 and table 2) I want a new calculated column in tabel 2.

 

logic is as below

 

if ColA and ColB (Tabel1) matches with Col1 and Col2 (Tabel2)   new column should say "Scheduel" if not it should say "New"

 

Below is a image of the tabels 

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    amitchandak , 

     

    it works, thanks a lot chapm. 

     

    would you be able to explain the DAX machnics behind it. why would you use COUNTX, I thouugh it could get done with a LOOKUPVALUE function mearging with AND. (I tried it and failed).

     

     

6 Replies

  • Hi,

    Write this calculated column formula in Table2

    =if(calculate(countrows(table2),filter(table1,table1[ColA]=earlier(table2[Col1])&&table1[ColB]=earlier(table2[Col2])))>0,"Schedule","New")

    Hope this helps.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      It does  not work