Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why my aggregation not working in expression in chart

I am having a chart where i am showing the monthly trend .

in the chart if i am clicking on any month from calendar , my expression works fine which is using aggregation to show value

but does not work if i clear and select year and show for all month with the same expression

I am using Year-Month eg. 2015-Apr as my DImension and doing aggregation on a different field

Please suggest if i am missing something  in my

4 Replies
swuehl
MVP
MVP

Please post your expression.

Not applicable
Author

I am trying to get the Sum of duration_sec divided by total duration of  Month for Model Keys with outage type 1


Sum({$<[outage_type]={1}} Aggr(Num((Sum({$<[outage_type]={1}>} duration_sec)/Num#(Interval(MonthEnd([Call_Year-Month])-MonthStart([Call_Year-Month]),'ss'))),'####.#####'),model_key))

This same expression gives desired output if we select a Month but does not gives correct value over overall trend

jonathandienst
Partner - Champion III
Partner - Champion III

Here's your expression with the unnecessary formatting elements (Num, Interval) removed. This divides the summed durations by the number of seconds in the month range:

Sum(

  Aggr(

  Sum({$<[outage_type]={1}>} duration_sec)

  /

  ((MonthEnd(Max([Call_Year-Month])) - MonthStart(Min([Call_Year-Month]))) * (24*60*60))

  ,model_key)

)

If you intend to divide by the number of days:

Sum(

  Aggr(

  Sum({$<[outage_type]={1}>} duration_sec)

  /

  (MonthEnd(Max([Call_Year-Month])) - MonthStart(Min([Call_Year-Month])))

  ,model_key)

)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

I added Call_Year-Month as dimension in aggr function and it worked. Thanks for suggestions