Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
analyticsuser
Contributor
Contributor

Using AGGR() in Line chart

Hello,

 I'm trying to display 12 months of data in a line chart by using AGGR() in set expression. however, it works well in a table but in line chart it doesn't display as needed.

For instance, my expr - avg(aggr(sum({<year={'Curr Year'}>} Sales),DeptName) gives the right value in a straight table with Month as Dimension 

How can I get it to work in a line chart for all 12 months?

5 Replies
Anil_Babu_Samineni

Perhaps this, If you have Date Field, Get Month field and use like this

avg(aggr(sum({<Month={">$(=AddYears(Max(Month), -1))<=$(=Max(Month))"}>} Sales),DeptName))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
analyticsuser
Contributor
Contributor
Author

That didn't work. I want the chart to display the average of Sales for all departments from Jan-Dec with Month as Dimension. In a table, it works well but not in line chart. 

Anil_Babu_Samineni

It should work for line chart as well until unless you have some other conditions enabled.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
analyticsuser
Contributor
Contributor
Author

I just have Month as Dimension and using the above expression to display in the graph for each month. When there's no month selection, I would like the graph to show sales by department by each month. 

Anil_Babu_Samineni

If you required by department add dimension as department and then expression should be

avg(TOTAL <Month> aggr(sum({<Month={">$(=AddYears(Max(Month), -1))<=$(=Max(Month))"}>} Sales),DeptName))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)