Using if() in  aggregate filter

Using if() in  aggregate filter

I am having some issues using the built in function If() in an aggregate filter,
so basically what is happening is:
- When I do this inside the filter:
If(UsedGroup = 0 ,NullIdentifier(),IntegerToEntityRefInteger(UsedGroup))
and pass as test value 407 int, I get the expected result, the agreggate returns all the records filtered by 407.
However when i pass 0 int, it returns no records althought i have records with "INDICADORES.Grupo = 0".
The funny thing is if i replace the all filter with :

INDICADORES.Grupo = nullIdentifier()

I get the expected result.

So basically does anyone know why is this happening and how can i work around it without an advanced query?
Hi João,

First, this seems like a tech post, and therefore should better be placed in the Technology forum - I'm sure it would've got more attention there.

As for your question, have you looked at the SQL that's created for the aggregate? That's usually a good way to see what's going on under the hood.