Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate different means based upon user's selection???

This is might be very challenging. I created a line chart based upon aggregate data from raw data with a referenc line indicating the overall average. The dimension is yearMonth. I would like to let user select a yearMonth in the listbox, the average before selected date and average after selected date can be calculated. I want to show these two new averages. Is this possible?

Thanks

3 Replies
Not applicable
Author

=Avg({$< yearMonth={"<=$(=GetFieldSelections(yearMonth) )"}>} Amount)

display when getselectedcount(yearMonth)=1

Then do the opposite for the other side.

In you graphed expression you will likely need to put in a set to exclude the yearMonth selection.  i.e. {$<yearMonth=>}

Not applicable
Author

It looks like anything is possible in Qlikview. Thanks. I will try your ideas and get back with you. Have a good weekend!

Not applicable
Author

I created two alternate states: state1 assigned to the chart1 and yearMonth listbox1 and state2 assigned to listbox2 which is copied from listbox1. In this way, the selection in listbox2 will not affect the chart1 in order to add average lines before and after the yearMonth selected in listbox2. I created two variables: YearMonthState1 and YearMonthState2 which links to listbox2. I tried to assign YearMonthState2 to YearMonthState1 when selection is made (or changed) in listbox2, in order to use YearMonthState1 in Chart1's expression, but no success. There is no selection event in listbox. I tried to use trigger event at document level, don't know how to do it. I do not know whether I am in the right track. Thanks