funcio no va

Tinc una funció que va bé

SUM( SELECT(Vacances[Valor Vacances],
AND(
[Treballador] = [_ThisRow].[Treballador],
YEAR(TODAY()) = YEAR([dia])
)))

però en quant hi afegeixo

Vacances[Motiu] = “D’empresa”

on
Vacances[Motiu] es una columna Enum
i el valor “d’empresa” és correcte

queda així

SUM( SELECT(Vacances[Valor Vacances],
AND(
[Treballador] = [_ThisRow].[Treballador],
YEAR(TODAY()) = YEAR([dia]),
Vacances[Motiu] = “D’empresa”
)
))

i no funciona i em dona error

No es pot comparar la llista amb el text a (Vacances[Motiu] = “D’empresa”)

Algú em pot dir perqué no funciona?

Vacances[Motiu] is a list of values. “D’empresa” is a single value. Even if the list comprises only a single value, it’s a list and that can’t equal any single value. Try using the [IN](AppSheet function list - AppSheet Help function.

1 Like

Ara no em dona error

SUM(
SELECT(Vacances[Valor Vacances],
AND(
[Treballador] = [_ThisRow].[Treballador],
YEAR(TODAY()) = YEAR([dia]),
IN(“D’empresa”,Vacances[Motiu])
)
)

pero continua sumanat els mateixos registres que abans, per tant no em serveix de filtre, que es el que no esta be?

My prior response was simply addressing the AppSheet error message you reported. I don’t know what function you need to return the values you want since I’m not familiar with your data.

Here’s another potential pitfall:

  • IN("D'empresa",Vacances[Motiu]) evaluates whether the value “D’empresa” is included anywhere in the Vacances table’s entire [Motiu] column across all rows. That might not be what you want.
  • If you want to evaluate row by row whether the [Motiu] column equals the value “D’empresa”, then just use that comparison without any function: [Motiu] = "D'empresa".
1 Like