Error: Given key not present in dictionary when adding AND() to SELECT()

Hi there, I have a weird error that comes up in a scheduled report template …could not be parsed due to exception: Given key not present in the dictionary

the error is in this expression in the highlighted text (and it doesnt matter if I add the table name in front which is the same as the summed variable anyway):

<<(sum(select(Asset[Amount Defaulted in RWF],[Default Date Cohort]=(if(month(today())<5,year(today())-1,year(today()))&”-”&(switch(Month(today()),1,9,2,10,3,11,4,12,Month(today())-4)))))-sum(select(Asset[Amount Defaulted in RWF],and([Number of days in default]=>30,[Default Date Cohort]=(if(month(today())<5,year(today())-1,year(today()))&”-”&(switch(Month(today()),1,9,2,10,3,11,4,12,Month(today())-4)))))))/sum(select(Asset[Total Amount Advanced on Asset in RWF],[Default Date Cohort]=(if(month(today())<5,year(today())-1,year(today()))&”-”&(switch(Month(today()),1,9,2,10,3,11,4,12,Month(today())-4)))))*100&” %-points”>>

A bit of explanation to the above:- I’m trying to calculate how many percentage points of assets defaulted during the month four months prior to the current month (calling months “cohort”, in the format of YYYY-MM) were settled within the first 30 days of being in default by subtracting all the defaulted assets that were in default for more than 30 days before dividing by the entirety of the sum that was supposed to be settled during this month

If I remove this additional filter expression it works fine. the column exists on the right table. Help?

[Number of days in default]=>30 should be [Number of days in default]>=30 (>= instead of =>).

2 Likes