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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
aliyoung92
Contributor III
Contributor III

Expression working in object but not when in chart

Hi, below is quite a complex expression that basically works out if two measure are increasing and if so does the calculation. It is using Max Year and Max Year -1 as I want to compare to previous year.

IF(Sum(Aggr(Avg({<YEARCALC={"$(=Max(YEARCALC))"}>}[Number attended]),EventID,PREVINSTNAME)) > Sum(Aggr(Avg({<YEARCALC={"$(=Max(YEARCALC)-1)"}>}[Number attended]),EventID,PREVINSTNAME)) AND

(Sum(Aggr(Avg({$<Enrolled={1},YEARCALC={"$(=Max(YEARCALC))"}>}FPE),SUBJECTAREA,INSTANCEKEY)) /

Sum(Aggr(Avg({$<YEARCALC={"$(=Max(YEARCALC))"}>}FPE),SUBJECTAREA,INSTANCEKEY))) - (Sum(Aggr(Avg({$<Enrolled={1},YEARCALC={"$(=Max(YEARCALC)-1)"}>}FPE),SUBJECTAREA,INSTANCEKEY)) /

Sum(Aggr(Avg({$<YEARCALC={"$(=Max(YEARCALC)-1)"}>}FPE),SUBJECTAREA,INSTANCEKEY))) > 0,(Sum(Aggr(Avg({$<Enrolled={1},YEARCALC={"$(=Max(YEARCALC))"}>}FPE),SUBJECTAREA,INSTANCEKEY)) /

Sum(Aggr(Avg({$<YEARCALC={"$(=Max(YEARCALC))"}>}FPE),SUBJECTAREA,INSTANCEKEY))) - (Sum(Aggr(Avg({$<Enrolled={1},YEARCALC={"$(=Max(YEARCALC)-1)"}>}FPE),SUBJECTAREA,INSTANCEKEY)) /

Sum(Aggr(Avg({$<YEARCALC={"$(=Max(YEARCALC)-1)"}>}FPE),SUBJECTAREA,INSTANCEKEY))),'')

However when I add to Table as below, it comes back blank as the end of the expression, but I know it works when ive tested it in an object. It is something to do with having Year as a dimension but i'm not sure what.

YEAR       YEARCALC   Example A      Expression Above

2013/14    2014              ABC

2014/15    2015              DEF

2015/16    2016              GHI

Any help would be appreciated

2 Replies
Anonymous
Not applicable

Hi Young,


Can yo add sample application here? This help's to understand the problem easily.


Thanks,

Venkata Sreekanth


sunny_talwar

Does it work when you remove YEAR and YEARCALC as dimensions? I think you might need to use Above() function instead of set analysis to make this work