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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
tchovanec
Creator II
Creator II

Use of P() in set analysis


I am trying to get all the possible values 12 months back from the selections made in calendar. Here is what I am trying, but it is not working.

Sum(
{<
ACTUALLASTDAY = {"$(=((P(AddMonths(BUDGETEND,-12)))))"}
>}
VISIT_COUNT)

Thanks for any assistance.

5 Replies
jchoucq
Partner - Creator III
Partner - Creator III

hi,

what do you want to do exactly ?

whatever the selection in your month list, you always want to calculate your sum on the 12 months ?

Regards.

Johann

tchovanec
Creator II
Creator II
Author

If I have Jan 2012 selected I need it to calculate for Jan 2011. If I have Jan 2012 and Aug 2012 selected I need it to calculate for just Jan 2011 and Aug 2011 not the months in between.

Not applicable

I think you don't need to use the P() function to do this.


Try this :

Sum( {< ACTUALLASTDAY = {">= $(=AddMonths(max(ACTUALLASTDAY),-12)) < $(=max(ACTUALLASTDAY))"} >} VISIT_COUNT)


By the way, I don't understand the link between your need and the field BudgetEnd ?


regards

stéphane

tchovanec
Creator II
Creator II
Author

Stephane I am using BUDGETEND because it is a island Calendar. Also, your suggestion will not work because it will take all the monthe in between my selections. For instance if I have JAN-2013 and AUG-2013 chosen it will take all the values between JAN-2012 and AUG-2012. I am just wanting the values for JAN-2012 and AUG-2012.

Not applicable

I think i understand what you want.

I suggest you to build two distinct fields in your model : month and year so you can make selection on month or on year.

This way the expression would be just : Sum( {< YEAR= {"$(=max(YEAR)-1)"} >}VISIT_COUNT)