I am making a calculated field from some calculated fields.
the field is and its working!
everything is going well until I add a field, which has a different logic. When i add other field,
the field that gives me an error when adding is like this :
distinct_countIf({COD_PTO_VENTA}, {CALC_FECHA_VENTA}>=${pFechaDesde} and {CALC_FECHA_VENTA}<=${pFechaHasta})
and the others field are this: ifelse({CALC_FECHA_VENTA}>=${pFechaDesde} and {CALC_FECHA_VENTA}<=${pFechaHasta},
{CALC_MARGEN}, 0)
Hi @Raulsc
Can you please specify what is the error? But it most likely because you are using aggregation. But description of the error will help confirm it.
why is the aggregation? the field that is error is this: distinct_countIf({COD_PTO_VENTA}, {CALC_FECHA_VENTA} >= addDateTime(-1,‘YYYY’,${pFechaDesde}) and {CALC_FECHA_VENTA} <= addDateTime(-1,‘YYYY’,${pFechaHasta}))
Either all the fields have to be aggregated, or none of them can be aggregated within a single calculated field. Assuming you are doing a SUM on the other 5 fields above it, wrap those in SUM to make them all aggregated (your last one already has aggregation (distinct count) built into it).
Its true with most BI tools - in a single calculated field either all fields need to be aggregated or all need to be non-aggregate (same with Tableau and others). It has to do with the query pipeline.