Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlik Community.
I have this following issue, i need to save max and min values in variables:
I have attached screenshot and document to clarify.
(If you are interested the end goal is to use the information to axis dimensions in a chart).
Thanks many times in advance.
Try this in a text box:
='max: ' & max({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}
aggr(sum({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}Sales),Year,Week))
& chr(10) &
'min: ' & min({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}
aggr(sum({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}Sales),Year,Week))
You probably use an aggregation with set analysis in your expression, then your required Expression (e.g. used in a text box) might look
=Min( SetExpressionUsedInYourExpression Aggr( YourExpression, Week, [Employee Team]))
=Max( SetExpressionUsedInYourExpression Aggr( YourExpression, Week, [Employee Team]))
Try this in a text box:
='max: ' & max({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}
aggr(sum({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}Sales),Year,Week))
& chr(10) &
'min: ' & min({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}
aggr(sum({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year>}Sales),Year,Week))
Hi Swuehl, Thanks for your quick reply. It almost works?
Hi Gysbert. Thanks for the fast reply. The min value works, but not the max?
Have you added the [Employee Team] to the aggr() dimensions?
I implemented your answer one more time, and this time it worked - thanks!
I came back to this question, and realized it only worked when I added the Employee Team, so the final answer look like this:
='min: ' & min({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year,[Employee Team]>}
aggr(sum({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year,[Employee Team]>}Sales),Year,Week,[Employee Team]))
='max: ' &
max({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year,[Employee Team]>}
Aggr(sum({<Date={">=$(=DATE(Max(Date)-7*4))<=$(=DATE(Max(Date)))"},Week,Year, [Employee Team]>}Sales),Year,Week,[Employee Team]))