Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone.
So I have an issue that I have spent so much time on and it's driving me crazy. I want to calculate the difference of the count of blooddonors this year vs previous year.
count({<[status] = {'0, '1, '2'},
[unitnumber] = {"=Len(unitnumber) = 12"},[donationyear] = {"$(=Max([donationyear]))"}>} distinct [blooddonor_id])-count({<[status] = {'0', '1', '2'},
[unitnumber] = {"=Len(unitnumber) = 12"},[donationyear] = {"$(=Max([donationyear])-1))"}>} distinct [blooddonor_id])
🤔
In the data manager i extracted the Year drom the donationdate and named it donationyear.
Yet it still isn't working. It returns the count of donors for only the selected year.
Help?
Hello Sunny @sunny_talwar Can you try to help this fellow, I couldn't do it, it seemed like an easy task, but not so much 🙂
thanks in advance 🙂
I haven't been able to solve this yet 😞
thank you Tomo for your interest 🙂
Hello,
Please Try out the following set expression, I think this should satisfy the requirement.
(Expression A) -(Expression B).
Expression A will be as follows :
Count({<donationdate ={">=$(=date(yearstart(max(donationdate )))) <=$(=date(max(donationdate )))"}>}blooddonor_id)
Expression B will be as follows :
Count({1<donationdate ={">=$(=date(Addyears(yearstart(max(donationdate )),-1))) <=$(=date(Addyears(max(date),-1)))"}>}blooddonor_id)
Also, you can add the other restrictions in these set expressions as per your requirement.
The image will give an idea about how the expression works.
Let me know if this works out or if you have any queries.
Thanks & Regards.
Rohan S. Desai.
Two things
Count({<[status] = {'0', '1', '2'}, [unitnumber] = {"=Len(unitnumber) = 12"}, [donationyear] = {"$(=Max([donationyear])-1))"}>} DISTINCT [blooddonor_id])
So, try this for previous year
Count({<[status] = {'0', '1', '2'}, [unitnumber] = {"=Len(unitnumber) = 12"}, [donationyear] = {"$(=Max([donationyear])-1)"}>} DISTINCT [blooddonor_id])