Ifelse + LAC-A/LAC-W

Even if you fix the syntax, I think you’ll still get another error because of the ifelse. The condition in your ifelse function is evaluated in each row of the dataset but median and stdevp are aggregated.

I posted an article about LAC today. I have a section that covers LAC with ifelse and mismatched aggregation errors. Take a look and let me know if it’s helpful.