Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
chapil
Contributor III
Contributor III

Filter object if expression

hello guys, 

I have a problem, so I want to do a special filter : 

I need to have only the payment dates 1 years old age (by YYYYMM format) 

For example : 

Max payment date = 202108 so I need all the monthyear between this date and 202108 minus 1 year so 202008 -> 202108 202107 202106 ... 202009 202008

I put this formula in the filter object :

 =if(date([PAYMENT DATE],'YYYYMM') >= date(max( addyears([PAYMENT DATE],-1)), 'YYYYMM'), date([PAYMENT DATE],'YYYYMM'), '') 

 

But the formula seems good, when I validate it, the dimension is not good 

Can someone help me please, 

Thanks a lot 

Labels (1)
1 Solution

Accepted Solutions
chapil
Contributor III
Contributor III
Author

Yes, it works ! 

Thanks a lot stevejoyce!

View solution in original post

4 Replies
stevejoyce
Specialist II
Specialist II

A calculated dimension will need an aggr, i'll assume you want this related to PAYMENT DATE.  Also globalize your max calcuation with $(=.  Try this...

=aggr(if(date([PAYMENT DATE]) >='$(=date(max( addyears([PAYMENT DATE],-1))))', date([PAYMENT DATE],'YYYYMM'), null()) , [PAYMENT DATE])

chapil
Contributor III
Contributor III
Author

Thanks for your solution, it works but don't have the result I expect 

I did it without aggr for one of my filter and it works (I would like the same for my dimension payment date) 

=if([DOC TYPE]='3Z'or [DOC TYPE]='60', [DOC TYPE], '') 

stevejoyce
Specialist II
Specialist II

how about 

=if(date([PAYMENT DATE]) >='$(=date(max( addyears([PAYMENT DATE],-1))))', date(floor(MonthName([PAYMENT DATE])),'YYYYMM'), null())

chapil
Contributor III
Contributor III
Author

Yes, it works ! 

Thanks a lot stevejoyce!