Bring information from other table depending on two diferents parameters

Hi Team,

Im trying to build an expression that returns the value of a certain column, of a row, of a table called “SERVICES”.
This table contains the different services, and the different columns contain the different prices of the services according to the number of customers.
for example, when [BASE] = 2. I need the expression to return the value of the column “SERVICES [USD 2]”

How should I structure the expression so that the column that the formula returns to me changes according to the base quantity?

This is the closest that I have managed to do

ANY(
SELECT(
SERVICIOS[USD 1],
AND([ID]=[_THISROW].[SERVICIO],
[BASE]=1)
OR(
ANY(
SELECT(
SERVICIOS[USD 2],
AND([ID]=[_THISROW].[SERVICIO],
[BASE]=2)
))
OR(
ANY(
SELECT(
SERVICIOS[USD 3],
AND([ID]=[_THISROW].[SERVICIO],
[BASE]=3)
))
)
)
))

Thanks for helping!!

Please post some screenshots and the table schema to understand how your data is layout

thanks for answering

1 Like

1 Like

1 Like

1 Like

Try this:

INDEX(
  LIST(
    [USD 1],
    [USD 2],
    ...,
    [USD N]
  ),
  [BASE]
)

See also:

Thanks for answering, but it didnt work.

I have also tried this.
But even though the formula is valid, it doesn’t work correctly, and it never returns a value.

IFS(
AND(
[_THISROW].[BASE] = “1”,
[_THISROW].[MONEDA] = “USD”),
LOOKUP([_THISROW].[SERVICIO],“SERVICIOS”,“ID”, “USD 1”),

AND(
[_THISROW].[BASE] = “2”,
[_THISROW].[MONEDA] = “USD”),
LOOKUP([_THISROW].[SERVICIO],“SERVICIOS”,“ID”, “USD 2”),

AND(
[_THISROW].[BASE] = “3”,
[_THISROW].[MONEDA] = “USD”),
LOOKUP([_THISROW].[SERVICIO],“SERVICIOS”,“ID”, “USD 3”),

AND(
[_THISROW].[BASE] = “4”,
[_THISROW].[MONEDA] = “USD”),
LOOKUP([_THISROW].[SERVICIO],“SERVICIOS”,“ID”, “USD 4”),

AND(
[_THISROW].[BASE] = “5”,
[_THISROW].[MONEDA] = “USD”),
LOOKUP([_THISROW].[SERVICIO],“SERVICIOS”,“ID”, “USD 5”),
)