Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
chhavi376
Creator II
Creator II

Average Line By Month

Hi All,

I Have a Geography Drill down (Area, Region and Territory)

My requirement is to create a line chart by month and geography drill down, with an average line. (If we are on Area, we get a  National Average, if we select one Area, we will get our chart by month and the regions corresponding the selected area, and we would want to display an average line for the selected area.

Case 1: Nothing selected 

clipboard_image_0.png

Case 2: Area = East is selected, we get a line with East Average

clipboard_image_1.png

 

 

Can you please help me with the same?

 

Thanks in advance.

 

 

Labels (3)
1 Reply
Lisa_P
Employee
Employee

You will first need to make your MonthYear into a field in your load script.

Then you can use nested if statement in your average reference line calculation combined with Aggr function. 

eg

If(GetSelectedCount(Area)>0,    
Avg(Aggr(Sum(Value), MonthYear, Region)),
Avg(Aggr(Sum(Value), MonthYear, Area)))

//  If any areas are selected use the Average Value per MonthYear and Region, else per MonthYear and Area