Hello @danielreyes3rd, sorry I missed your response!
The issue with the calculation you are running is that you are expecting it to partition the same way that it is within the pivot table. The table contains the client_region_name
field, so that is where each individual sum is occurring. That is completely ignored as soon as it is used within the KPI. You will need the sum functions to occur at the region level, then have the maxOver check across each region sum. It will need to look more like this:
maxOver((sumOver(ifelse(truncDate('DD', {created_ts}) = truncDate('DD', ${EndDate}), dateDiff({process_start_ts}, {process_end_ts}, 'SS')/60, NULL), [{client_region_name}], PRE_AGG) - sumOver(ifelse(truncDate(‘DD’, {created_ts}) = addDateTime(-1, ‘DD’, truncDate(‘DD’, ${EndDate})), dateDiff({process_start_ts}, {process_end_ts}, ‘SS’) / 60, NULL), [{client_region_name}], PRE_AGG)) / sumOver(ifelse(truncDate(‘DD’, {created_ts}) = addDateTime(-1, ‘DD’, truncDate(‘DD’, ${EndDate})), dateDiff({process_start_ts}, {process_end_ts}, ‘SS’) / 60, NULL), [{client_region_name}], PRE_AGG), [], PRE_AGG)
Here, you will notice that the sumOver functions contain the client_region_name field within the partition, but the maxOver will have an empty partition field. This should allow it to get the max value across all of the region. Let me know if this helps!