Forum Discussion
Funcion suma con IN
Me encuentro ante esta dificultad:
En la siguiente fórmula, quiero indicar que el campo DepositoDestino_id es el 3 o que el campo está en blanco.
PP ALTA 0 y 3 = CALCULATE(SUM(Movimientos[Cantidad]), FILTER(Movimientos, Movimientos[Alta] = TRUE), FILTER(Movimientos, Movimientos[DepositoDestino_id] IN {0,3}))
No funciona. SI hago 2 fórmulas, sí funciona:
PP ALTA 3 = CALCULATE(SUM(Movimientos[Cantidad]), FILTER(Movimientos, Movimientos[Alta] = TRUE), FILTER(Movimientos, Movimientos[DepositoDestino_id] = 3))
PP ALTA 0 = CALCULATE(SUM(Movimientos[Cantidad]), FILTER(Movimientos, Movimientos[Alta] = TRUE), FILTER(Movimientos, Movimientos[DepositoDestino_id] = 0))
Quisiera saber cuál es la forma de tener el total en una sola fórmula y no tener que hacerlo en 2. Muchas gracias.
- Anonymous5 years ago
HI MMPagola,
I modify your formula to use AND, OR logic function to link two conditions, you can try to use the below formula if helps:
PP ALTA 0 y 3 = CALCULATE ( SUM ( Movimientos[Cantidad] ), FILTER ( Movimientos, AND ( Movimientos[Alta] = TRUE, OR ( Movimientos[DepositoDestino_id] = 0, Movimientos[DepositoDestino_id] = 3 ) ) ) )If the above formula not works, can you please some dummy data to test? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
3 Replies
- amitchandak
Super User
MMPagola , Try like and check
PP ALTA 0 y 3 = CALCULATE(SUM(Movimientos[Cantidad]), FILTER(Movimientos, Movimientos[Alta] = true() && Movimientos[DepositoDestino_id] IN {0,3}))
- MMPagola
Helper II
Hola, gracias por tu ayuda pero no funciona. Asi, me toma solamente las cantidades del depósito 3
- AnonymousNot applicable
HI MMPagola,
I modify your formula to use AND, OR logic function to link two conditions, you can try to use the below formula if helps:
PP ALTA 0 y 3 = CALCULATE ( SUM ( Movimientos[Cantidad] ), FILTER ( Movimientos, AND ( Movimientos[Alta] = TRUE, OR ( Movimientos[DepositoDestino_id] = 0, Movimientos[DepositoDestino_id] = 3 ) ) ) )If the above formula not works, can you please some dummy data to test? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng