Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

getcurrentfield() for Groups does not work when used with aggr() in Trellis Chart

Background

I created a stacked bar chart showing sales by product group over time. I then created a Trellis chart with region as a dimension. I found that the y-axis was too high, so I changed it to a static max with this expression: max(aggr(sum(sales), date, region)). Everything worked perfectly.

Problem

When I changed the dimension of the Trellis chart from region to a cyclic group containing region and business unit, I realized I'd need to change the expression above for the static max of my axis so that it would update based on the cyclic group selection. I changed the expression to this: max(aggr(sum(sales), date, getcurrentfield(groupname))) where 'groupname' was the name of the group I created. This did not work, and the y-axis max did not change.

Is my expression for the static max of the y-axis off the mark or is there some kind of bug with QlikView?

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Hi,

Try this:

max(aggr(sum(sales), date, groupname)

View solution in original post

3 Replies
kaushalview
Partner - Creator II
Partner - Creator II

Hi,

try ur expression like this

(aggr(sum(sales), date, getcurrentfield(Region,business uit))

Regrads

Kaushal Mehta

erichshiino
Partner - Master
Partner - Master

Hi,

Try this:

max(aggr(sum(sales), date, groupname)

Not applicable
Author

Thanks, Erich! You were spot on! I hadn't tried that because QlikView shows groupname with a red underline in that expression, suggesting the expression isn't correct.

It appears that QlikView isn't consistent in the way it reports the value of a group.

For example, if I simply if I use any of the following in the window title field, the value of the group is not displayed

=groupname

=[groupname]

If, however, I use this in the window title field, the value of the active element in the group is displayed!

=getcurrentfield(groupname)

So, for some odd reason, QlikView requires you to use getcurrentfield() in some cases and not in others. It's frustrating to say the least.