Nested filter Calculation

My problem involves creating a calculation in QuickSight to replicate the Past ARR value of the latest expired contract across all rows for each account, while filtering out future contracts. The challenge is that QuickSight does not allow nested aggregation functions or direct comparisons between aggregated and row-level fields, which leads to errors when trying to match the past contract’s date and its corresponding TCV.

I tried to do (Latest_Date_Expired_Contract)

maxOver(maxIf({Last Date of Contract}, {Last Date of Contract} < now()), [{Account Name}])

To replicate in each rows the Latest Date of Expired Contract.

Then I tried different approaches using firstValue, MaxOver based on the filter above to get the Past ARR value. For example:

firstValue(
ifelse({Last Date of Contract} = {Latest_Date_Expired_Contract}, TCV, NULL),
[{Last Date of Contract} DESC],
[{Account Name}]

But, my aim here is that:

I have Accounts Opened by Campaigns.
And I want to replicate at the Account level, based on the campaigns dates, if the Campaign Contract was expired, the value that corresponds to its Latest Expired Campaign.

Hello @lregis , welcome to the QuickSight community!

You could try flagging the row that has the last expired date and then maxing the TCV. So taking your original calculation and using it in an ifelse:

Is_Latest_Expired_Contract =
ifelse({Last Date of Contract} = {Latest_Expired_Contract_Date}, 1, 0)

Then create:
Past_ARR_Value =maxIf({TCV}, {Is_Latest_Expired_Contract} = 1)

Let me know if this works or runs into any errors!

Hi @lregis,
It’s been awhile since we last heard from you on this thread, did you have any additional questions regarding your initial post or were you able to find a work around for your case?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @lregis,
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community.

Thank you!