How can I calculate a running sum with sumif?

Hi Team,

I have a calculated field: SelectedTitlesRevenue_w that is calculated basis parameters and looks like this:

sumIf(revenue,

(${UserChoiceOfBenchmark} = ‘TopNRevenue’ and {wbr_region} = ${WBRregion} and {diff_weekly} <= ${DiffWeekly} and {rnk_rev} <= ${RankRevenue} and in({window_type} , ${WindowType}))

OR

(${UserChoiceOfBenchmark} = ‘BenchmarkManual’ and {wbr_region} = ${WBRregion} and in({title_name}, ${BenchmarkManualTitles}) and {diff_weekly} <= ${DiffWeekly} and in({window_type} , ${WindowType}))

OR

(${UserChoiceOfBenchmark} = ‘TopNRevenueByContractID’ and {wbr_region} = ${WBRregion} and {contract_id}= ${ContractID2} and {rnk_contract_rev} <= ${TopNContractID} and {diff_weekly} <= ${DiffWeekly} and in({window_type} , ${WindowType}))

)

Now I want to calculate a running sum of these values so I can plot cumulative total by week.

Tried using runningSum() I get an error that says Nesting of Aggregate functions cannot be used…
Is there a way to achieve this or is there a workaround to use sumif inside runningsum()?

Thanks in advance!

Edit: Solved it using runningsum() and partition by combinations

1 Like