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: 
rkhadraoui1016
Contributor II
Contributor II

Possible for last year of the selected date

Hi All, I am in the middle of working out an expression but I would like some help as I can't figure it out.

I have a Date filed in the form of "MM-YYYY" in a data island and when selecting a date I have an expression like so:

Sum({<Account_Date=P(MC_Date)>} PAGING_CPM)

which works fine even with the multiple selections (i.e May-2018, Jul-2018), but my issue is when I need to calculate the same for last year which I can't work it out. Can I do a set analysis inside the Possible to workout last year or is there any other solution?

Thank you in advance for your help.

1 Solution

Accepted Solutions
rkhadraoui1016
Contributor II
Contributor II
Author

Hi,

 

I've found the solution as below:

Sum({<Account_Date={$(vDateCal)}>} PAGING_CPM)

Where the vDateCal = CHR(39) & concat(AddYears(MC_Date,-1) & chr(39),',' & CHR(39))

works a treat, just in case someone comes across something similar.

View solution in original post

3 Replies
Anil_Babu_Samineni

Yup, This will work using Possible as well. Try this?

Sum({<Account_Date=P({<Account_Date={"$(=AddYears(Max(Account_Date), -1))"}>} MC_Date)>} PAGING_CPM)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
rkhadraoui1016
Contributor II
Contributor II
Author

Hi Loveisfail

 

rkhadraoui1016
Contributor II
Contributor II
Author

Hi,

 

I've found the solution as below:

Sum({<Account_Date={$(vDateCal)}>} PAGING_CPM)

Where the vDateCal = CHR(39) & concat(AddYears(MC_Date,-1) & chr(39),',' & CHR(39))

works a treat, just in case someone comes across something similar.