Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

optimize expression

Hi Community,

I need to optimize the expressions, like same expressions I have all the months.

ROUND(SUM(agGr(
ONLY({<Type={'PRIMARY'},fill_flag={1},Month={$(=MAX(Month))}>}Sales)/100,
ID, Pno, description, Sales, rank))
+
SUM(agGr(
ONLY({<Month={$(=MAX(Month))},Name={'ABC'}, Flag={'ALL'}>}Sales)/100,
ID, Pno, description, Sales, rank)), 0.01) 

chart taking to more time to display - is there any way to optimize expression?

Thanks in Advance!

 

 

 

Labels (1)
4 Replies
anat
Master
Master

can you try by creating the flag in load script like below :

if(Type='PRIMARY'  and fill_flag=1,1,0) as flag1,

if(Name='ABC' and  Flag='ALL',1,0) as flag2

then

use below set analysis logic:

 

ROUND(SUM(agGr(
ONLY({<flag1={1},Month={$(=MAX(Month))}>}Sales)/100,
ID, Pno, description, Sales, rank))
+
SUM(agGr(
ONLY({<Month={$(=MAX(Month))}, flag2={1}>}Sales)/100,
ID, Pno, description, Sales, rank)), 0.01) 

 

 

 

Anil_Babu_Samineni

@paulwalker In My opinion, you don't need two expressions and two times aggregate. Rather you can perhaps look this?

Round(Aggr(SUM({<Type={'PRIMARY'}, fill_flag={1}, Month={$(=MAX(Month))}, Name={'ABC'}, Flag={'ALL'}>} Sales)/100,ID, Pno, description, Sales, rank), 0.01)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
paulwalker
Creator III
Creator III
Author

One expression is PRIMARY sales and another expression is NON-PRIMARY sales -

would it work above expression ?

Anil_Babu_Samineni

@paulwalker In that case If you want to run both expression to the addition of non-sales. Because Aggr() usually kills the performance and on that you have used Only (). Not sure of the intent here. Maybe this still work 🙂

The correct expression,

ROUND(Aggr((SUM({<Type={'PRIMARY'},fill_flag={1},Month={$(=MAX(Month))}>}Sales)/100
+
SUM({<Month={$(=MAX(Month))},Name={'ABC'}, Flag={'ALL'}>}Sales)/100),
ID, Pno, description, Sales, rank),0.01)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful