I want to use a sumIf
inside an ifelse
to do something like this:
ifelse(
{country}="US", sumif({amount}, {dimension}="Type 1"),
{country}="CA", sumif({amount}, {dimension}="Type 2"),
NULL)
However, when I try this, I get errors. I think it’s because I can’t use a sumIf
inside an ifelse
function. Is there any other way to accomplish the same? Thanks in advance!
Naveed
May 12, 2022, 11:18am
2
sambhavbhandari:
ifelse(
{country}="US", sumif({amount}, {dimension}="Type 1"),
{country}="CA", sumif({amount}, {dimension}="Type 2"),
NULL)
Hi,
have you tried it.
sum(ifelse(
{country}=“US”, sumif({amount}, {dimension}=“Type 1”),
{country}=“CA”, sumif({amount}, {dimension}=“Type 2”),
NULL)(
I tried adding
sum( ifelse(
{country}=“US”, sumif({amount}, {dimension}=“Type 1”),
{country}=“CA”, sumif({amount}, {dimension}=“Type 2”),
NULL))
but the error persists.
Hi,
please try this:
sum(
ifelse({country}=“US” AND {dimension}=“Type 1”,{amount},
ifelse({country}=“CA” AND {dimension}=“Type 2”,{amount},NULL))
)