Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

New Column Lookupvalue with a filter on another Tab

Hi together, 
I have to check if  in the table "data_Current" the email is matching with an email in the table "users" and it should only match when the User in the table "users" does have an model "IOS" or "Android" in table "devices".

 

Table Data_Current

Email

Imei

Username

[email protected]

1234

test.1

[email protected]

12345

test2

[email protected]

123456

test2

[email protected]

null

test3

[email protected]

1212

test100

 

Table Devices

User-ID

IMEI

SERIAL Number

Model

1

12345

abcde

Andorid

2

22222

abce

Android

3

34333

aaaa

IOS

3

33456

aaaae

Dell

4

12345

ertssd

Dell

5

111111

asdas

IOS

 

Table Users:

USER-ID

EMAIL

Name

1

[email protected]

Meyer

2

[email protected]

Lampe

3

[email protected]

Anton

4

[email protected]

Magda

5

[email protected]

Meyer

 

My suggestion would be to create a new column in the table current_data if the email[current_data] is in the table [users] and the user in table [users] has a model ("Android" or "IOS") in Table [devices].

The solution should be:

Email

Imei

Username

NEW COLUMN

[email protected]

1234

test.1

Yes

[email protected]

12345

test2

No

[email protected]

123456

test2

No

[email protected]

null

test3

Yes

[email protected]

1212

test100

Yes

 

9 Replies

  • Anonymous ,

    new column= var _1  = count(User, current_date[email] = user[email]),user[email])

    return

    if(isblank(_1) , "No", "Yes")

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, 
      as you can see in the Solution. User test.1 & test.3 & test.100 should be Yes.
      I have updated the description with one picture, maybe this help

  • Hi, Anonymous ,
    I tested your sample data and you got an error in the Devices table as IMEI should be unique, however, with modifying one row, here is my working solution:

    Check = 
    var Model_Check = LOOKUPVALUE(Devices[Model],Devices[IMEI],Current_Data[IMEI])
    var MAIL_Check = LOOKUPVALUE(Users[EMAIL],Users[EMAIL],Current_Data[Email])
    
    RETURN IF(Model_Check="Android" || Model_Check="IOS" && NOT(ISBLANK(MAIL_Check)), "Yes", "No")

     

    Please note, you only need the "Check" column, I added the two more just for you to clarify what'S going on.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, 
      as you can see in the Solution. User test.1 & test.3 & test.100 should be Yes.
      I have updated the description with one picture, maybe this help

      • vojtechsima's avatar
        vojtechsima
        Icon for Super User rankSuper User

        Hi,
        Anonymous 

        I found a few inconveniences in your sample data:
        If you wanna relate the tables using "user ID", [email protected] cannot Return True, also you have duplicity in Devices, meaning the Lookup can't tell which row should be assigned to. Also, you have a typo in [email protected], his device is "Andorid", not "Android", thus it can't return TRUE. 

        If I delete duplicity and ignore Test10, here is my solution:

        Check = 
        var Model_Check = LOOKUPVALUE(Devices[Model],Devices[User-ID],Current_Data[UserID])
        var UserID = RELATED(Users[USER-ID])
        
        RETURN IF(Model_Check="Android" || Model_Check="IOS" && NOT(ISBLANK(UserID)), "Yes", "No")