Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
analyticsuser
Contributor III
Contributor III

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))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
analyticsuser
Contributor III
Contributor III
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.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
analyticsuser
Contributor III
Contributor III
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))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful