Forum Discussion

jabrillo's avatar
jabrillo
Icon for Helper I rankHelper I
3 years ago
Solved

Two Calculated Columns with Similar LOOKUPVALUE Have Different Results

I created two calculated columns. Column 1 shows result = "Yes" and alternate result = "No". Column 2 with same set of conditions shows result = searched column and alternate result = "N/A". So if Column 1 = "Yes", Column 2 should = searched value, and if Column 1 = "No", Column 2 should = "N/A". But sometimes, in some rows, Column 1 = "Yes" and Column 2 = "N/A". Why?

 

Table1

Col1ACol1BCol1CCol1D
GreenAppleYesSummer
RedStrawberryYesFall

 

Table2

Col2ACol2BCol2CCol2D
RedStrawberryYesFall
RedAppleNoN/A
GreenAppleYesN/A
YellowPearNoN/A

 

Col2C = lookupvalue(Table1[Col1C], Table1[Col1A], Table2[Col2A], Table1[Col1B], Table2[Col2B], "No")

Col2D = lookupvalue(Table1[Col1D], Table1[Col1A], Table2[Col2A], Table1[Col1B], Table2[Col2B], "N/A")

Third row Col2D column is incorrect. Value should be Summer.

  • Hi, jabrillo 

     

    You can try the following methods.

    Column2C = 
    Var _N1=CALCULATE(MAX(Table1[Col1C]),FILTER(Table1,[Col1A]=EARLIER(Table2[Col2A])&&[Col1B]=EARLIER(Table2[Col2B])))
    Return
    IF(_N1=BLANK(),"No","Yes")
    Column2D = 
    Var _N2=CALCULATE(MAX(Table1[Col1D]),FILTER(Table1,[Col1A]=EARLIER(Table2[Col2A])&&[Col1B]=EARLIER(Table2[Col2B])))
    Return
    IF(_N2=BLANK(),"N/A",_N2)

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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

     

2 Replies

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, jabrillo 

     

    You can try the following methods.

    Column2C = 
    Var _N1=CALCULATE(MAX(Table1[Col1C]),FILTER(Table1,[Col1A]=EARLIER(Table2[Col2A])&&[Col1B]=EARLIER(Table2[Col2B])))
    Return
    IF(_N1=BLANK(),"No","Yes")
    Column2D = 
    Var _N2=CALCULATE(MAX(Table1[Col1D]),FILTER(Table1,[Col1A]=EARLIER(Table2[Col2A])&&[Col1B]=EARLIER(Table2[Col2B])))
    Return
    IF(_N2=BLANK(),"N/A",_N2)

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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