Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lprasanth
Contributor II
Contributor II

aggr count distinct optimization

I want the following code to be optimized. can anyone please help me on this

 

(count(if(WildMatch(ID,'GR*')>0,
aggr(count({<idStatut={14}>}DISTINCT ID),Wse_Name,[Channel Name],MoisePrévu,Corpo_Name,Gln_Name_Dpt,ID),
aggr(count({<idStatut={14}>}DISTINCT ID),Wse_Name,[Channel Name],MoisePrévu,Corpo_Name,ID)))
-
count(if(WildMatch(ID,'GR*')>0,
aggr(count({<idStatut={12}, idResp={'CARRIER'}>}DISTINCT ID),Wse_Name,[Channel Name],MoisePrévu,Corpo_Name,Gln_Name_Dpt,ID),
aggr(count({<idStatut={12}, idResp={'CARRIER'}>}DISTINCT ID),Wse_Name,[Channel Name],MoisePrévu,Corpo_Name,ID))))
/
count(if(WildMatch(ID,'GR*')>0,
aggr(count({<idStatut={14}>}DISTINCT ID),Wse_Name,[Channel Name],MoisePrévu,Corpo_Name,Gln_Name_Dpt,ID),
aggr(count({<idStatut={14}>}DISTINCT ID),Wse_Name,[Channel Name],MoisePrévu,Corpo_Name,ID)))

Labels (3)
2 Replies
sunny_talwar

It would be easier to respond to this if we have a sample where we can test out a solution.... Without a sample the only thing you can look into changing is to move the if statement (WildMatch(ID,'GR*')) to the backend to create a flag in the script.... the flag can be used in set analysis...

Brett_Bleess
Support (Former)
Support (Former)

In addition to what Sunny posted, I can only add the following Design Blog posts:

https://community.qlik.com/t5/Qlik-Design-Blog/Pitfalls-of-the-Aggr-function/ba-p/1463275

https://community.qlik.com/t5/Qlik-Design-Blog/When-should-the-Aggr-function-NOT-be-used/ba-p/146785...

There are likely some other posts that could be helpful too, so here is the base URL for the area you can use to search further on your own:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.