I am trying to calculate the cost of different job types over the total number of operations over a date range. For this, I have a date_granularity calculated field that is truncating the date part of the depending on the user choice date_parameter:
ifelse(
${granularity}='Quarter',truncDate('Q',{date}),
${granularity}='Month',truncDate('MM',{date}),
${granularity}='Week',truncDate('WK',{date}),
truncDate('DD',{date})
)
The cost field is calculated as follows:
sum(
{job_cost},
[{date_granularity}, {job_type}]
)
The distinct count uses the same calculated field for the partitions and is called num_operations_in_window:
distinct_count(
{operation_id},
[{date_granularity}]
)
When I try to divide the two fields:
{job_type_cost}/{num_operations_in_window}
I get the error:
The Level Aware Calculation (LAC) aggregate functions inside one visual aggregate functions should always share the same grouping key
Is there some workaround to this? I just want to divide those two fields (first one is job_type_cost and the second one is num_operations_in_window):