Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Controlling expression in chart by user selection

Hi,

I have a chart which is kinked to periods listbox selections: year, month, day

There is a Sum expression which should be calculated differenly in case a day or a month is selected.

For example, if a day is selected then sum(X).

For Month, it should be Sum(X+Y).

How can I distinguish between the selections?

Thanks in advance!

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

You can create an expression for each Sum expression and activate the option conditionnal :

Expressions condition.jpg

For example the condition GetFieldSelections(day) = 1 is true when one and only one day is selected.

Hope it helps.

Regards,

Nicolas

View solution in original post

5 Replies
Not applicable
Author

Use the method getSelectedCount(Field) to know hhow many rows of a field are selected. For your case, your can do:

if(getSelectedCount(Year)=0, sum(X), if(getSelectedCount(Month)=0, sum(X+Y))

Not applicable
Author

Hi,

You can create an expression for each Sum expression and activate the option conditionnal :

Expressions condition.jpg

For example the condition GetFieldSelections(day) = 1 is true when one and only one day is selected.

Hope it helps.

Regards,

Nicolas

CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

if(getselectedcount(Day)>0, Sum(X), Sum(X+Y))

Anonymous
Not applicable
Author

Hi brain,

         i have one doubt like if both are selected what you needed.

Thanks

Not applicable
Author

Hi All,

Actually all answers were very helpful, but I liked the tip with the Conditional

Thanks!