Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
andoryuu
Creator III
Creator III

Getting the Max of Aggr results

I'm using the following expression in an attempt to get the highest distinct count of a field by date.  I've attached a picture that shows this expression grouped by date.  I would expect that when I remove the date field I would see 172 as the value (the max of the AppAndEngineObjectId for all the days).  However, I see 12275 - the total distinct count for the whole dataset is 12639.  

=max(aggr(Count(Distinct AppAndEngineObjectId),SheetAccessDate))

1 Solution

Accepted Solutions
andoryuu
Creator III
Creator III
Author

The attached is my data model.  Relationship is SheetUsageList (1||M) - AppAndAppObjects (1).   When I remove the AppAndAppObjects table the expression works.  If I add a field to my SheetUsageList table using RowNo() and use that as the field I get the following results which are pretty different all together.  The below at least does give me the max rows in a day, but that's not what I was looking (i was looking for distinct app/app object combos - by row level includes the datetime as well as you can see in the data model).  

 

I'm not really bothered by these results, I'm just misunderstanding something about how AGGR works when it's a part of multiple tables...

clipboard_image_1.png

 

 

View solution in original post

5 Replies
kashyap
Partner
Partner

Hi Andoryuu,
I tried with the same expression is yours and it's working fine for me. So if u attach the qvf file then I can try.
Thanks
StarinieriG
Partner
Partner

Hi,

try to use total

=max(total aggr(Count(Distinct AppAndEngineObjectId),SheetAccessDate))

sunny_talwar

Expression should have worked... what happens when you use the same expression in a KPI object? Do you see 172 then?

andoryuu
Creator III
Creator III
Author

The attached is my data model.  Relationship is SheetUsageList (1||M) - AppAndAppObjects (1).   When I remove the AppAndAppObjects table the expression works.  If I add a field to my SheetUsageList table using RowNo() and use that as the field I get the following results which are pretty different all together.  The below at least does give me the max rows in a day, but that's not what I was looking (i was looking for distinct app/app object combos - by row level includes the datetime as well as you can see in the data model).  

 

I'm not really bothered by these results, I'm just misunderstanding something about how AGGR works when it's a part of multiple tables...

clipboard_image_1.png

 

 

View solution in original post

sunny_talwar

I am not really sure I understand your concerns? What exactly do you not understand about Aggr()? What is wrong in the image you have shared below?