How to make multiple math expressions for a single column

Hello, there. I’ve been trying to do a calculation in a table in a single column, i don’t really know which solution will fit the best with this problem that i have.


in this table MetodoPago (payment method), there are many types of payments [MetodoPagoDescripcion] payment method description (Credit, debit, cabal, cash, and others)
when the payment method is selected, every payment method should have a different tax.
So if one payment method is selected, should do a math, for example:
if [MetodoPagoDescripcion] = ‘Credito’ then [Credito] = [MetodoPagoMonto] * 0.06

so in the totals my formula is [TotalMP] = [MetodoPagoDescripcion] - ([Credito]+[Debito]+[Cabal])
i’ve tried to do all the calculations in virtual columns, and only made it valid if the selected payment is the one with that tax discount, but in the execution every discount column has a value even if isn’t the selected payment method

i’ve tried many things, but i’m kinda stucked to be honest, i’m not that good with the logic of programation, nor english so if you see something isn’t write well please feel free to correct me!
Any help will be appreciated, Greetings!

Solved Solved
0 4 731
1 ACCEPTED SOLUTION

Hello @bulgogi94, i see your column names are in spanish, so i’ll answer your question in spanish hehe.

Si en una transacción dada sólo puede haber 1 método de pago que se selecciona de una lista, podes hacer ese cálculo en una sola columna utilizando la función SWITCH(), este es el enlace a su página de documentación:

Como ejemplo, la aplicación de esta fórmula en tu caso seria la siguiente:

SWITCH(
[MetodoPagoDescripcion],
“Credito”,[MetodoPagoMonto]*0.06,
“Debito”,[MetodoPagoMonto]*0.10,
“Cabal”,[MetodoPagoMonto]*0.15
)

Puedes colocar esta fórmula en una columna común, de modo a tener guardada la información de esa comisión o impuesto que estás calculando por cada transacción, y podes colocar en otra columna común este cálculo que mencionaste:

in the totals my formula is [TotalMP] = [MetodoPagoDescripcion] - ([Credito]+[Debito]+[Cabal])

Si tenes otra duda no dudes en preguntarme 3X_d_5_d51363a862e7ab883241c312ac5d7f271579cdd3.gif

View solution in original post

4 REPLIES 4
Top Labels in this Space