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

Selecting previous year with current selection

Dear experts,

I have a question to ask regarding how I can select a previous year selection with a current set analysis selection which i have already made. Having looked and tried other solutions on the forum they were specific for the problem and I could not find a general solution where I was able to use, can anyone please help me out with this issue?

My code is as of such,

Sum({$<BDF_Type={"*Revenue*"}> * $<[fiscal year]-1> }cash)

What I am trying to achieve is to select all the BDF type with the characters revenue as well as the previous fiscal year selection. The reason why i used the " * "  because I thought it would be a union set, but I am very sure that syntax is used wrongly in this context.

The fiscal year date format is given as 2010,2011,2012 etc.

Kind regards,

Royce

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

This statement is syntactically and logically correct in the set analysis -  [fiscal year] = {'$(=Max([fiscal year])-1)'}

I expect your required expression looks like:

=Sum({<BDF_Type = {"*Revenue*"}, [fiscal year] = {"$(=Max([fiscal year])-1)"}>} cash)

(sum cash where BDF_Type starts with Revenue having a fiscal year one less than the largest value)

If that does not work, then something else is going on (such as fiscal date extending into the future), so I suggest that you post a small sample qvw to illustrate the problem.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

6 Replies
Anil_Babu_Samineni

Can you try like below then we can sort it out if values are generated

Sum({$<BDF_Type={"*Revenue*"} >} cash) * Sum({$<[fiscal year] = {'$(=Max([fiscal year])-1)'}> }cash)

// By above expression, I am showing for cash data points where Search string is Revenue and the Cartesian with Last Year(i.e., 2011). Is this you are expecting?

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
Not applicable
Author

I have tried that expression however it gives a 0 value I do believe the second part of the syntax is incorrect.

{'$(=Max([fiscal year])-1)'}> } the ' ' syntax seems to be making the function =Max into a string or something

Anil_Babu_Samineni

It should work if your Fiscal Year has data points. Any how. Is that same you are looking because you have mentioned [Fiscal Year]-1 Here what is your intend to show

Would you provide sample, Please?

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
jonathandienst
Partner - Champion III
Partner - Champion III

This statement is syntactically and logically correct in the set analysis -  [fiscal year] = {'$(=Max([fiscal year])-1)'}

I expect your required expression looks like:

=Sum({<BDF_Type = {"*Revenue*"}, [fiscal year] = {"$(=Max([fiscal year])-1)"}>} cash)

(sum cash where BDF_Type starts with Revenue having a fiscal year one less than the largest value)

If that does not work, then something else is going on (such as fiscal date extending into the future), so I suggest that you post a small sample qvw to illustrate the problem.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

You are right, I had a inline statement for fiscal year and used the original year set as the one with data points now it works perfectly! cheers

Not applicable
Author

Cheers for the input once again !! it really helped. May I please also ask if it is possible to have

(sum cash where BDF_Type starts with Revenue having a fiscal year one less than the CURRENT SELECTED VALUE)?


kind regards,

Royce