Cuenta de clientes

Buen dรญa a todos y gracias de antemano por leer la preguntaโ€ฆ

Estoy creando una app para llevar los trabajos realizados de fertilizaciรณn con clientes, y no se cรณmo sumar los datos de la columna [COSTO ESTIMADO] en la tabla TRABAJOS que no estรฉn ya cobrados (Columna [COBRADO] en valor [FALSO]) y que ese resultado se exprese en la columna [CUENTA] de la tabla โ€œCLIENTESโ€.

La tabla [CLIENTES]:


La fรณrmula que uso en la celda [CUENTA] es:
SUM(select(TRABAJOS[COSTO ESTIMADO],AND([CLIENTE]=[_Thisrow].[CLIENTE],[COBRADO]=โ€œFALSOโ€)))

y la tabla trabajos:


Saludos!!!

Solved Solved
0 2 95
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Maxi

Your formula is almost correct, though I would bring a subtle change, please see below:

SUM(
 SELECT(TRABAJOS[COSTO ESTIMADO],
  AND(
    [CLIENTE]=[_THISROW],
    NOT([COBRADO])
   )
 )
)

Please note, that this part : [CLIENTE]=[_THISROW]
can also be expressed as [CLIENTE]=[_THISROW].[ID_CLIENTE]

For your goal, you need to use a virtual column.
You are currently using a physical column, which wonโ€™t be updated unless you edit the row.
Virtual column are always calculated on the fly, so result is always correct.

To do so:

  • Remove your column from your spreadsheet.
  • regenerate structure in the app editor
  • add a virtual column on your table (there is a button)
    3X_a_4_a4437a42a11a00c6f4cd73ce6ea9d1864ad2779a.png
    Then, set the name โ€œCuentaโ€ and the app formula: the one above.

It should do the job, let us know if thatโ€™s OK for you.

For reference:

View solution in original post

2 REPLIES 2

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Maxi

Your formula is almost correct, though I would bring a subtle change, please see below:

SUM(
 SELECT(TRABAJOS[COSTO ESTIMADO],
  AND(
    [CLIENTE]=[_THISROW],
    NOT([COBRADO])
   )
 )
)

Please note, that this part : [CLIENTE]=[_THISROW]
can also be expressed as [CLIENTE]=[_THISROW].[ID_CLIENTE]

For your goal, you need to use a virtual column.
You are currently using a physical column, which wonโ€™t be updated unless you edit the row.
Virtual column are always calculated on the fly, so result is always correct.

To do so:

  • Remove your column from your spreadsheet.
  • regenerate structure in the app editor
  • add a virtual column on your table (there is a button)
    3X_a_4_a4437a42a11a00c6f4cd73ce6ea9d1864ad2779a.png
    Then, set the name โ€œCuentaโ€ and the app formula: the one above.

It should do the job, let us know if thatโ€™s OK for you.

For reference:

Thanks You!!! This is what I need.

Thanks You so much

Maxi

Top Labels in this Space