if($(vLastMonthRevenue) < 0 or $(vCusAvgRevLThreeMonths) < 0, null(), $(vLastMonthRevenue)/$(vCusAvgRevLThreeMonths)-1)
Table gives me these results which are not matching to each other - Customer Trend Percentage is incorrect (correct result should be 0.11%
Customer Name | Cus. Avg Revenue - 3 Months before Last Month | Last Month Revenue | Customer Trend Percentage
Customer A | 14 320 | 14 337 | -88.88%
RESULT OK RESULT OK INCORRECT RESULT
It is strange though, that solution seems to be to wrap vCusAvgRevLThreeMonths variable in aggr() function with Customer Name used in it. But why does this work? It would make sense to me that, then I would have to do the same thing with vLastMonthRevenue variable too, but that doesn't seem to be necessary. How exactly Qlik Sense calculates this?
Any ideas are more than welcome. Maybe, I am missing something very trivial.