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

How to compare a user selection and a value?

Hi,

The user wants to compare revenue growth for two years.

Suppose a user selects 2 values of field YEAR. I need the sum of VALUES for min(YEAR) in a column and the sum of VALUES for max(YEAR) in a second column so I can compute the growth between the 2 selected years.

I was trying (using set analysis) this:

sum({<YEAR = {"$(=min(YEAR))"} VALUE)


    and


sum({<YEAR = {"$(=max(YEAR))"} VALUE)

But this does not work. Any suggestions?

Thanks in advance!

1 Solution

Accepted Solutions
sunny_talwar

You missed the closing set analysis syntax (>})

These are working now:

=Sum({<Year = {"$(=Min(Year))"}>} Revenue)

=Sum({<Year = {"$(=Max(Year))"}>} Revenue)


Capture.PNG

View solution in original post

7 Replies
sunny_talwar

I don't see a reason for this not working.... Can you share a sample or snapshot to show what exactly do you get and explain as to what you are looking to get?

renzedegraaf
Contributor II
Contributor II
Author

Hi Sunny,

I don't know how to upload my sample qvw, so here some screenshots.

sample1.png

sample2.png

sunny_talwar

Look here to see how a sample can be uploaded

Uploading a Sample

sunny_talwar

I think you are using two variation of Year (Year and YEAR).... QlikView is case sensitive and you need to make sure you are using the correct casing...

Sum({<Year = {"$(=min(Year))"} VALUE)

or

Sum({<YEAR = {"$(=min(YEAR))"} VALUE)

renzedegraaf
Contributor II
Contributor II
Author

I uploaded a sample app to explain my problem.

sunny_talwar

You missed the closing set analysis syntax (>})

These are working now:

=Sum({<Year = {"$(=Min(Year))"}>} Revenue)

=Sum({<Year = {"$(=Max(Year))"}>} Revenue)


Capture.PNG

renzedegraaf
Contributor II
Contributor II
Author

Thanks!