Add a reference line to the analysis with the value from the Parameter in QuickSight

I am trying to add a reference line to my analysis from the value provided by the parameter, I have attached the screenshot of my configuration. The problem is the value is getting doubled when I use the group by functionality in the analysis. Can you help me fix the issue. I have attached the screenshot in the first 2 comments of this post.

Divided the calculated field based on parameter by countOver(primarykey, [casetype], PRE_AGG). Primary key is the lowest level dimension of your dataset.