Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
mohdhaniff
Creator
Creator

Expression total count for past 12 Months

Hi,

Currently, I am using below expression for getting total for a specific date for past months:

count({$<[Disbursement MthStart]={"$(=Date(addmonths(max([Disbursement MthStart]),-11),'DD-MMM-YYYY'))"}>} if(Product='AFFSTR0001', [Account No]))

From the script I can only having a result for total of 1 [Disbursement MthStart] only. Can anybody help me to modified the script for me getting the total value between past 11 months until current (Max)?

1 Solution

Accepted Solutions
sunny_talwar

May be this

Count({$<[Disbursement MthStart] = {"$(='>=' & Date(AddMonths(Max([Disbursement MthStart]),-11), 'DD-MMM-YYYY') & '<=' & Date(Max([Disbursement MthStart]), 'DD-MMM-YYYY'))"}>} if(Product='AFFSTR0001', [Account No]))

Or this (converting if statement to set analysis

Count({$<[Disbursement MthStart] = {"$(='>=' & Date(AddMonths(Max([Disbursement MthStart]),-11), 'DD-MMM-YYYY') & '<=' & Date(Max([Disbursement MthStart]), 'DD-MMM-YYYY'))"}, Product *= {'AFFSTR0001'}>} [Account No])

View solution in original post

2 Replies
sunny_talwar

May be this

Count({$<[Disbursement MthStart] = {"$(='>=' & Date(AddMonths(Max([Disbursement MthStart]),-11), 'DD-MMM-YYYY') & '<=' & Date(Max([Disbursement MthStart]), 'DD-MMM-YYYY'))"}>} if(Product='AFFSTR0001', [Account No]))

Or this (converting if statement to set analysis

Count({$<[Disbursement MthStart] = {"$(='>=' & Date(AddMonths(Max([Disbursement MthStart]),-11), 'DD-MMM-YYYY') & '<=' & Date(Max([Disbursement MthStart]), 'DD-MMM-YYYY'))"}, Product *= {'AFFSTR0001'}>} [Account No])

mohdhaniff
Creator
Creator
Author

Great!!

New knowledge for me... Thanks Sunny.

Regards