Why can't I create multiple options in same conrol filter at the same time?

Hi,
I’m trying to create a control filter using parameter. For that purpose, I have created a parameter (lets say ‘filters’), passed ‘All’ as a static value, and created a control filters and passed ‘All’, ‘A’ and ‘B’ as a list.
Now I’m trying to create a calculated field so that can be used as filter, if i write two condition separately, then it works, for example

calculted_field =
ifelse(
${filters} = ‘All’, 1,
${filters} = ‘A’ AND {num_logs_with_authorizations_percentage} < .98 , 1,
0
)

it works and following code works too.

calculted_field =
ifelse(
${filters} = ‘All’, 1,
${filters} = ‘B’ AND isNull({num_logs}), 1,
0
)

But if I put these 2 condition together, then it doesn’t work, it found an error,

calculted_field =
ifelse(
${filters} = ‘All’, 1,
${filters} = ‘B’ AND isNull({num_logs}), 1,
${filters} = ‘A’ AND {num_logs_with_authorizations_percentage} < .98 , 1,
0
)

the above is not working, find an error. How can I overcome this problem
Any advice will be helpful.

Thank you

Hi @sadhanm22 ,

What is the error you are seeing?
is it related to aggregation mismatch? If so, are the num_log fields direct dataset fields or calculations?

Thanks,
Prantika

it only says error found, doesn’t give any explicit reason,

{num_logs_with_authorizations_percentage}

is calculated fied in dataset level, and {num_logs) is direct dataset field.

If you hover over the red underline, you may get a message.

Syntax wise the formula looks good. so the error type can help us determine the root cause.

I did tried to hover around, but did not show anything.

Sorry, you are right, That’s the problem
“Mismatched aggregation. Custom aggregations can’t contain both aggregated and nonaggregated fields, in any combination.”

So I have changed code a bit and it’s working fine,

calculted_field =
ifelse(
${filters} = ‘All’, 1,
${filters} = ‘B’ AND isNull(sum({num_logs})), 1,
${filters} = ‘A’ AND {num_logs_with_authorizations_percentage} < .98 , 1,
0
)

To make both column aggregate type. However, as I use it as control filters, these filters are working on table level but not on KPI level.

When you say table level, but not on KPI level, what dimension are you using in Tables? You may need to modify the calculation to make them level aware.

Can you share some more insight on what you are implementing in the table?

Hi @sadhanm22,
It’s been awhile since we last heard from you, did you have any additional questions regarding your initial post or were you able to find a work around?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @sadhanm22,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!