Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is This Expression is correct Sum({$<year={'$(=Year)','$(=$(=(Year)-1})'}>}Sales)??


Hi Guys,

              I post an expression regarding sum of sales for Current selection and Previous selection of Year..Is that correct expression??

11 Replies
MK_QSL
MVP
MVP

Try as below

SUM({<Year = {'$(=Max(Year))'}>}Sales)          For Current Year

SUM({<Year = {'$(=Max(Year)-1)'}>}Sales)       For Last Year

Let us know what you want to get as a result?

If you want sales for last two year, use as below

=SUM({<Year  = {'>=$(=Max(Year)-1)<=$(=Max(Year))  '}>}Sales)

Not applicable
Author

you want a sum of this year + last year?

Not applicable
Author

Hi,

Sum({$<year = {'$(=Year)', '$(=(Year - 1))'}>} Sales)

maxgro
MVP
MVP

do you mean max year and previous?

=sum({$<Year={$(=max(Year)),$(=max(Year)-1)}>} Sales)

its_anandrjs

Hi Rajesh,

Use your SET script like below script


=Sum({$<YourYearField = {'$(=Max(YourYearField))' , '$(=Max(YourYearField)-1)' } >}Sales)

Joseph_Musekura
Support
Support

Hi

Did you try

sum ({$<Year={$(#=Only(Year))}, Year={$(#=Only(Year)-1)}>}Sales)

Thanks!

Anonymous
Not applicable
Author

Yes I want Current and Last year

MK_QSL
MVP
MVP

There are so many answers given.

Isn't there any which is solving your problem?

Anonymous
Not applicable
Author

No But Here # Represents what??