IFS() dont work

Hi

Iโ€™m trying to use this formula

IFS(

[_THISROW].[COMPANY]=LOOKUP([_THISROW].[COMPANY],โ€œPontos de vendaโ€,โ€œCOMPANYโ€,โ€œCOMPANYโ€),
LOOKUP([_THISROW].[COMPANY],โ€œPontos de vendaโ€,โ€œCOMPANYโ€,โ€œCompany_IDโ€),

[_THISROW].[Email da empresa]=LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œCOMPANY_PERSON_EMAILโ€,โ€œCOMPANY_PERSON_EMAILโ€),
LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œCOMPANY_PERSON_EMAILโ€,โ€œCompany_IDโ€),

[_THISROW].[Email da empresa]=LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œEMAIL_1โ€,โ€œEMAIL_1โ€),
LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œEMAIL_1โ€,โ€œCompany_IDโ€)

)

but only the first phase works
"[_THISROW].[COMPANY]=LOOKUP([_THISROW].[COMPANY],โ€œSale Pointsโ€,โ€œCOMPANYโ€,โ€œCOMPANYโ€),
LOOKUP([_THISROW].[COMPANY],โ€œSale Pointsโ€,โ€œCOMPANYโ€,โ€œCompany_IDโ€),
"
But when donโ€™t find it in the first phase and move on to the second, it no longer works.
Is there something missing from the formula?

The key is [CRM_ID]

0 7 203
7 REPLIES 7

Steve
Platinum 4
Platinum 4

Youโ€™re using [_THISROW} where you shouldnโ€™t be. Try this:

IFS(

[COMPANY]=LOOKUP([_THISROW].[COMPANY],โ€œPontos de vendaโ€,โ€œCOMPANYโ€,โ€œCOMPANYโ€),
LOOKUP([_THISROW].[COMPANY],โ€œPontos de vendaโ€,โ€œCOMPANYโ€,โ€œCompany_IDโ€),

[Email da empresa]=LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œCOMPANY_PERSON_EMAILโ€,โ€œCOMPANY_PERSON_EMAILโ€),
LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œCOMPANY_PERSON_EMAILโ€,โ€œCompany_IDโ€),

[Email da empresa]=LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œEMAIL_1โ€,โ€œEMAIL_1โ€),
LOOKUP([_THISROW].[Email da empresa],โ€œPontos de vendaโ€,โ€œEMAIL_1โ€,โ€œCompany_IDโ€)

)

Hi Steve

I tried your solution but it doesnโ€™t work, itโ€™s the same. Do the first lookup and if you donโ€™t find it, donโ€™t do the second and third test.

By the way, if ORDER of how you check the IFS doesnโ€™t matter you can simplify the IFS into a SELECT like this:

ANY(SELECT(Pontos de venda[Company ID], 
                        OR([Company] = [_THISROW].[Company], 
                           [Company Person Email] =  [_THISROW].[Email da empresa],
                           [Email 1] = [_THISROW].[Email da empresa])
          )
)

Hi John
With this formula it always returns the first [company_id] it does not search for the key [CRM_id] of that line and returns the respective [company_id]

There is some confusion then. Your IFS did NOT use [CRM_id] in anyway. It always returned [Company_ID].

I did mention that if order does NOT matter then you could use the SELECT. The issue with the SELECT is that depending on how your data is structured, there may be multiple rows that match. The SELECT then returns only the first rowโ€™s [Company_ID]. It seems this will not work for you.

It might be helpful to describe your data tables and what your goal is. We might be able to better help come up with a workable expression.

Tks for the Quick answer

What Iโ€™m trying to do is in the table โ€œCustomersโ€ it compares the [Company] with the table โ€œPoints of saleโ€ column [Company] and if it finds a match then in the table โ€œPoints of saleโ€ extract the [Company_id].
If you donโ€™t find it, go to the next search in this case the [Company E-mail] and if you find extract the [Company_id] in the third step the same thing. But it looks like he only does the logical test on the first one.

Top Labels in this Space