Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
H-Zey
Contributor II
Contributor II

Set Expression inside the Aggr() Function

Hi All,

I have researched the community board and I thought I followed the docs and solutions that were posted however, I'm still running into an issue.

Problem Description: I'm using the Aggr() function as a measure in a line chart. It renders the data perfectly except that it does not execute the set Expression. Regardless if the set expression is inside the aggr or outside.

The data is in one table and is very similar to this sample data pasted below.

The measure that I'm using in the line chart is:

Aggr(avg(Score), Last_Updated_Date)

I get a chart like so (Note data in the chart is not the same as the sample data provided):

HZey_1-1665709543326.png

I then added the set expression at the Aggr level

=Aggr({<Score = {">=0"},Status = 'high'>}
avg(Score), Last_Updated_Date)

but no change occurs to the Chart. I even moved the expression inside the avg function and still not change

HZey_0-1665709268363.png

 

Labels (2)
1 Solution

Accepted Solutions
H-Zey
Contributor II
Contributor II
Author

Lisa, you are right that Qlik was case sensitive and once I modified the expression to this:

Aggr({<Score = {">=0"},Status = {"low"}>} avg( Score),Last_Updated_Date)

Everything worked fine

Agigliotti: Dropping the Aggr surprisingly worked too but only after I fixed the above syntax.

I thought that I needed to aggregate the data first but looks like qlik does that for you in this particular scenario.

 

View solution in original post

4 Replies
Lisa_P
Employee
Employee

Qlik is case sensitive, and you are missing some brackets, so change your expression to:
=Aggr(avg({<Score = {">=0"}, Status = {High}>} Score), Last_Updated_Date)

H-Zey
Contributor II
Contributor II
Author

Hi Lisa,

Still doesn't work. I checked the data and the values used. 

I feel that it is being ignored or not executed at all

agigliotti
Partner - Champion
Partner - Champion

Hi @H-Zey ,

Maybe this:

Avg( {< Score = {">=0"}, Status = {'High'} >} Score ) as measure

and Last_Updated_Date as dimension.

I hope it can helps.

Best Regards

H-Zey
Contributor II
Contributor II
Author

Lisa, you are right that Qlik was case sensitive and once I modified the expression to this:

Aggr({<Score = {">=0"},Status = {"low"}>} avg( Score),Last_Updated_Date)

Everything worked fine

Agigliotti: Dropping the Aggr surprisingly worked too but only after I fixed the above syntax.

I thought that I needed to aggregate the data first but looks like qlik does that for you in this particular scenario.