Sum row

Hello... I'm new here and I'm going to thank you very much for your help, forgive my English because I'm Spanish
and i'm using google translate
I must be doing something wrong in this formula,
IF(AND([_thisrow].[Proyección]> =[OBJETIVO],
SWITCH([PALANCA],
"Fibras xxxxx”, [_thisrow].[Proyección]>=[_thisrow]. [OBJETIVO],TRUE)),
SWITCH ([PALANCA],
"Fibras”, [_thisrow] .[Proyección]*2,
"Pospagos”, [_thisrow].[Proyección]*1,
"Prepagos”, [_thisrow]. [Proyección]*0.25,
"Fibras xxxxx ”, [_thisrow].[Proyección]*5,
"Total Comisión”, Sum(Select(RESUMEN VENTAS GPV[Comisión], [_thisrow].[Correo GPV]=[Correo GPV] )),
0),
0)

It works perfect for me for all rows except for this one


"Total Comisión", Sum(Select(RESUMEN VENTAS GPV[Comisión], [_thisrow].[Correo GPV]=[Correo GPV] )),

that you should add only those that correspond to each email...
and it does it the first time, but the next time what it does is double the amount...
I am doing something wrong, I hope you can help me. Thank you
😃
Solved Solved
0 7 403
1 ACCEPTED SOLUTION

Hola Deby,

Puedes utilizar:

SUM( Select(RESUMEN VENTAS GPV[Comisión], AND(
  [_thisrow].[Correo GPV]=[Correo GPV],
  NOT("Total Comisión" = [Palanca])
)))

Sin embargo, tu estructura de datos se puede mejorar. 

View solution in original post

7 REPLIES 7

Hola Deborah, saludos desde Madrid,

I'm not sure what result do you expect from your expression. For example what is the purpose of the first SWITCH if you have only one value, and why are you using [_ThisRow] outside a SELECT or equivalent. 

Perhaps if you can explain how your data is setup and what do you need to achieve I can better help you with the corresponding expression. Thanks. 

___

P.D. puedes escribir en español si necesario

Genial... escribo en español jejjee... gracias...

Te explico...

IF(AND([_thisrow].[Proyección]> =[OBJETIVO], 
SWITCH([PALANCA],
"Fibras xxxxx”, [_thisrow].[Proyección]>=[_thisrow] . [OBJETIVO],TRUE)),

la idea es que si estas 2 condiciones se cumplen, entonces trabajen las otras

Y multiplique cada fila según la condición,

que lo están haciendo perfectamente

Menos esta parte de la formula 

"Total Comisión”, Sum(Select(RESUMEN VENTAS GPV[Comisión], [_thisrow].[Correo GPV]=[Correo GPV ] )), 

Esta debería sumar la columna "Comisión"  siempre que el correo sea el mismo, pero no lo hace siempre... suma la primera vez ok... y si edito nuevamente, duplica la cantidad, cuando en realidad si no hay cambios debería mantener la cantidad inicial... no se si me he explicado ;D

¿Dónde estás metiendo esa expresión? ¿en qué columna y cuál es la tabla? ¿Qué columnas tiene esta tabla y la tabla RESUMEN VENTAS GPV? 

Me es imposible saber porqué tu expresión duplica la cantidad sin ver tu estructura de datos. 

¿Puedes por favor hacernos algunos capturas de pantalla de tus tablas y sus columnas? ¡Gracias!

Hola... perdón, no había podido responder antes... estas son las columnas involucradas de la tabla

En las filas "total comisión" de cada correo debería sumar los importes de la columna "comisión" correspondiente a ese correo. ahora esta bien porque lo he puesto manualmente porque tenia que presentarlo... 

La expresión esta en la Columna "Comisión"... Todas las columnas que utiliza la Expresión están en esta tabla que es  RESUMEN VENTAS GPV

Deby_0-1647067757237.png

Ya me dirás... muchas gracias de nuevo

Hola Deby,

Puedes utilizar:

SUM( Select(RESUMEN VENTAS GPV[Comisión], AND(
  [_thisrow].[Correo GPV]=[Correo GPV],
  NOT("Total Comisión" = [Palanca])
)))

Sin embargo, tu estructura de datos se puede mejorar. 

Genial... Funciona!!!!... había probado muchas variables menos esta... perfecto, muchas gracias... 

En cuanto a la estructura de Datos, pues si... es lo más seguro... aún estoy aprendiendo y me gusta hacerlo sobre la marcha...

Mil gracias de nuevo.

De nada.

Te aconsejo optimizar la estructura de datos desde el principio para evitar que tu app se ralentice con el crecimiento de tus tablas. 

Lee estos guías y intenta aplicar las normas indicadas en tu app. ¡Suerte!

Five Tips for Building Better Spreadsheets for Your AppSheet Mobile Apps 

Data: The Essentials | AppSheet Help Center 

Top Labels in this Space