Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aarav021
Contributor III
Contributor III

How to optimize the below charts expression

Hi all, I looking to optimize the below KPI expression for better app performance but couldn't figure out a solution. Your help is highly appreciated. I just want to reduce the calculation since the same calculation is being repeated for all 5 cases. Is it possible to calculate only only time with the help of pick and match to increase the performance. This is the urgent requirement. Please help.

NOTE-: I want to optimize the expression for better app performance I don't want to simplify the expression. 

if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=0 and getselectedcount(DATE)=0, ((count({<MONTH={'$(curr_moonth)'},VAL_CDE*={"*abc"}>}VAL_CDE)/ count({1<MONTH={'$(last_month)'},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100, if(GetSelectedCount(MONTH)=1 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=0 and getselectedcount(DATE)=0, ((count({<VAL_CDE*={"*abc"}>}VAL_CDE)/ count({1<MONTH={'$(prev_month)'},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100, if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=1 and GetSelectedCount(FY)=0 and getselectedcount(DATE)=0, ((count({<VAL_CDE*={"*abc}>}VAL_CDE)/ count({1<QUARTER={'$(quarter_name)'},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100, if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=0 and getselectedcount(DATE)>=1, ((count({<DATE= {">=$(=date(min(DATE)))<=$(=date(max(DATE)+1))"},VAL_CDE*={"*abc"}>}VAL_CDE)/ count({1<DATE= {">=$(=date(min(DATE)-(max(DATE)-min(DATE))-1))<=$(=date(max(DATE)-(max(DATE)-min(DATE))))"},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100, if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=1 and getselectedcount(DATE)=0, ((Count({<MONTH= {">=$(=Yearstart(max(MONTH),0,4))<=$(=Yearend(max(MONTH),0,4))"},VAL_CDE*={"*abc"}>}VAL_CDE)/ Count({1<MONTH={">=$(=Yearstart(max(MONTH),-1,4))<=$(=Yearend(max(MONTH),-1,4))"},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100)))))

Labels (3)
2 Replies
Digvijay_Singh

Are you sure calculation is repeating, I see different expression for each of 5 conditions?

Digvijay_Singh_0-1686184362125.png

 

aarav021
Contributor III
Contributor III
Author

Different as in like first case is based on current month and prev month, second case is calculating for month like if any month is selected. Third case is calculating for quarter, fourth case is for year and fifth case is for date. but these calculations are being multiplied by 100 only. So any possible solution where we can use pick and match or any other solution to optimize the code