Get previous year value with additional filters applied

I’ve a dataset as below:

I am trying to calculate Resolve Rate and the formula is as below:
sum(Resolved for Current Year) / sum(Total Issues from Last Year)

I have tried using the below calculations:
Total Issues from Previous Year =periodOverPeriodLastValue( sumOver(sum({HCC_COUNT}),[{Payment_Year_Date}]),{Payment_Year_Date})
Total Resolved = sum(Resolved)
Resolved Rate = {Total Resolved} / {Total Issues from Previous Year}
This works perfectly fine in a tabular visual / KPI using Payment_Year_Date column.

But if I apply a filter to show only current year resolve rate, the above calculation shows No Data since the previous year data is removed by filter. Also, I’ve to keep a reference to Payment_Year_Date and cannot use it in visuals like Guage Chart to compare the actual value for 2024 only and the target.

Pre-calculating the Total_Issues for previous_year in the dataset will not work since I’ve to apply the filters of Gender and Category as well.

Is there a way to calculate the above formula without having to keep a reference for Payment_Year_Date in the visual while keeping the additional filters (to filter rows from current & previous year)

hi @Zerry00

I am not sure how you configured the filter to show only current year but I think demo dashboard sharing under the tips and tricks could help.

kind regards,
Wakana

Hi @Zerry00

There is a nice article in the learning section that deals with period over period calculations.

One key aspect when dealing with prior periods is that your calculated fields does the filtering and you should not apply a filter on the visual itself. The parameter controls for dates will provide the range on the basis of which your calculated field would work.

Regards,
Giri

1 Like

Hi @Zerry00,
It’s been awhile since we last heard from you, did either of the suggestions above help point you in the right direction or do you have additional questions regarding your case?

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

Thank you!

Hi @Zerry00,
Since we haven’t 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 and link this discussion for relevant information if needed.

Thank you!

Thanks for the solution, using parameter controls in the calculation for filtering worked perfectly.