Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

Selected year vs previous year

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?

13 Replies
tomovangel
Partner - Specialist
Partner - Specialist

Hi, loannagr,

can you try this for 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] =  {">=$(=AddMonths(Min(donationyear), -12))"}>}distinct [blooddonor_id])

basically i use Addmonths 🙂 

 

I have used it and it works on my side 🙂 

 

ioannagr
Creator III
Creator III
Author

Nope, still the same. I'm losing my mind over this  😂

tomovangel
Partner - Specialist
Partner - Specialist

Hello, Can you try this expression Solo, it should give you blooddonorid's for last year.

 

count({<[status] = {'0', '1', '2'},
[unitnumber] = {"=Len(unitnumber) = 12"},

donationyear={$(=Max(donationyear)-1)}>}

distinct [blooddonor_id])

ioannagr
Creator III
Creator III
Author

It returns 0's for every year. When I remove the temporal variable set analysis works just fine, 

looks like there's something wrong with the date field use...

I've set the filter pane to donationyear instead of donationdate.autoCalendarYear   and it still doesn't work. 

(BTW , what should be the difference between these two?)

 

 I swear I don't know what I'm doing wrong. 😱 

tomovangel
Partner - Specialist
Partner - Specialist

oh, i didn't see a variable in your case. 

 

Anyway, if you want to include variables in your set analysis, you have to write them like:

 

'$(Variable)' or "$(Variable)" or $(Variable)

 

Try these cases

ioannagr
Creator III
Creator III
Author

Oh no I'm sorry, my bad, being a statistician i'm used to calling them fields as variables.

So yes we were talking about fields all the time.

 

The problem is in the use of this date field... something is not quite right. I'm working with data manager only, so any ideas?

Maybe donationyear is now a dimension not a temporal one so it can't work like that with addmonths etc?

tomovangel
Partner - Specialist
Partner - Specialist

hm. To be fair with you I have migrated to Qlik Sense from QlikView, and I am used to the Data Load Editor, and not the Data Manager, can you try the date field -360?

 

ioannagr
Creator III
Creator III
Author

Yes, nothing 😞

 

Is it possible that there is a problem with donationyear and donationdate.autoCalendar.Year?

 

How are they different?

tomovangel
Partner - Specialist
Partner - Specialist

@swuehl  Hi, can you offer some insight to this problem, I have wondered if there is an issue with the autocalendar maybe?