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: 
jyothish8807
Master II
Master II

Aggr with In set analysis


Hello Friends,

Can you please let me know how can we use aggr fun with in Set Analysis?Any manual or examples will be really helpful.

Thanks

KC

Best Regards,
KC
1 Solution

Accepted Solutions
tresesco
MVP
MVP

If your Currency in dimension, try like:

=FirstSortedValue(Aggr(Sum(rates),Date), -Date)   // If multiple rates are there for a date

=FirstSortedValue(rates, -Date)                               // when sigle rate for a date

Edit: The first exp, probably should be like: =FirstSortedValue(Aggr(Sum(rates),Currency,Date), -Date)

View solution in original post

8 Replies
amit_saini
Master III
Master III

Kc,

This may help you.

Thanks,

AS

vikasmahajan

PFA documents on AGGR,

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
tresesco
MVP
MVP

Set analysis evaluates once for an object while aggr() is more frequently used in chart to manupulate the normal dimension filter effect. Hence, use of aggr() in set analysis is not that usual. And, probably there is no such document. If you could explain your requirement with sample data, may be people here could help of better.

jyothish8807
Master II
Master II
Author

Hi Tresesco,

Iam just try to do this:

sum({<Date={"=Aggr(max(Date),Currency)"}>}rates)

I have Currency and Dates & rates corresponding to that.So i was trying to get the Rates when Date is max corresponding that Currency. Same Currency have different Rate corresponding to different dates.

Regards

KC

Best Regards,
KC
tresesco
MVP
MVP

If your Currency in dimension, try like:

=FirstSortedValue(Aggr(Sum(rates),Date), -Date)   // If multiple rates are there for a date

=FirstSortedValue(rates, -Date)                               // when sigle rate for a date

Edit: The first exp, probably should be like: =FirstSortedValue(Aggr(Sum(rates),Currency,Date), -Date)

jyothish8807
Master II
Master II
Author

Thanks Tresesco,

So we cant use Aggr function with in Set analysis ? And expression above is wrong ?

Best Regards,
KC
tresesco
MVP
MVP

We can, but it would not produce the desired result. Aggr() withing set analysis doesn't get evaluated multiple times (you might expect as many times as number of field values), it would just work for the first value(load order) of the field.

jyothish8807
Master II
Master II
Author

Got it .Thanks a lot tresesco.

Regards

KC

Best Regards,
KC