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: 
richard_chilvers
Specialist
Specialist

Maximum of a set of selected values

I have a chart showing sales values, and I allow the user to select which week or weeks they would like to show the values for. So they might select weeks 3,4 and 5.

I would like to have an extra chart which shows the total value from week 1 to the max week selected (so weeks 1-5 in my example).

Is there a function to select the max value in this way ?

Thanks

Richard

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

set analysis :

sum({<Week={>=1,<=$(=max(Week)} value)

update:

Sum({<Week={">=1<=$(=Max(Week))"}>} Value)

View solution in original post

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

No, you have to manage strings, in my example if your field is DIM then

=Mid(GetFieldSelections(DIM,',',50), Index(GetFieldSelections(DIM,',',50), ',', -1)+1)

let me know

giakoum
Partner - Master II
Partner - Master II

set analysis :

sum({<Week={>=1,<=$(=max(Week)} value)

update:

Sum({<Week={">=1<=$(=Max(Week))"}>} Value)

rubenmarin

Hi Richard,

In a simple example, if Week is a numeric field and expression is Sum(Sales), you can use:

Sum({<Week={'<=$(=Max(Week))'}>} Sales)

If user selects weeks 3-5, the Bold part tells qv to ignore week selection and calculate the expression like if Week selection was "<=5"

richard_chilvers
Specialist
Specialist
Author

Thank you for your fast response and correct solution to my problem.