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: 
darrellbutler
Creator
Creator

Aggregation Expressions not allowed in group by clause

Hi,

I'm trying to declare a variable but keep getting the following message.

Aggregation expressions not allowed in GROUP BY clause

Let vprod6daysago = (sum({$<[Link_Date] = {'07/04/2011'}, [TYPE] = {"COLL"}, [COMPANY_CODE] = {"0017"}>} [VOL]))

I've tried using the AGGR function, aggregating by Link_Date but this also doesnt work any ideas ?

Many thanks

Darrell

1 Solution

Accepted Solutions
pover
Partner - Master
Partner - Master

You are right in both cases, and yes, using dollar-sign expansion $(), you can use the expression you saved in a variable in any graph or other object.

Regards.

View solution in original post

4 Replies
pover
Partner - Master
Partner - Master

Darrell,

In the script you can't do set analysis or expressions directly

If you want to save the formula as a variable to use in the interfase, change the Let to a Set in your line of code.

If you want to calculate a number for use in the script, you should calculate the number in a load statement using a group by and where statement and then use the peek() function to save the value to a variable.

Regards.

darrellbutler
Creator
Creator
Author

Karl,

Manythanks for the quick response ! - Just to get things clear in my mind.

If i change the let to a set. I take it that I could then reference the variable in an expression such as =sum(vprod6daysago) is that right ?

Alternatively you suggest caculating the value using where and group by. I take it this would be based on a table already resident in my model and the where conditions are really just what I've put in my set analysis formula.

Thanks

darrellbutler
Creator
Creator
Author

Karl,

Just worked it out its = $(vprod6daysago) isn't it ? getting there !

Thanks for your help !

Darrell.

pover
Partner - Master
Partner - Master

You are right in both cases, and yes, using dollar-sign expansion $(), you can use the expression you saved in a variable in any graph or other object.

Regards.