Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
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)
@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)
One expression is PRIMARY sales and another expression is NON-PRIMARY sales -
would it work above expression ?
@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)