Hello,
i have to optimize one expression on chart :
if(sum({<Year={$(vCurrentYear)},Month={$(vCurrentMonth)},[Top]={"O"}>}[OD-Stock value]) <= sum({<Year={$(vYearBefore_MonthAfter)},Month={$(vMonthAfter)},[Top]={"O"}>}[OD-Sales]),
sum({<Year={$(vCurrentYear)},Month={$(vCurrentMonth)},[Top]={"O"}>}[OD-Stock value])*30/sum({<Year={$(vYearBefore_MonthAfter)},Month={$(vMonthAfter)},[Top]={"O"}>}[OD-Sales]),
if(sum({<Year={$(vCurrentYear)},Month={$(vCurrentMonth)},[Top]={"O"}>}[OD-Stock value]) <= sum({<Year={$(vYearBefore_MonthAfter)},Month={$(vMonthAfter)},[Top]={"O"}>}[OD-Sales])
+sum({<Year={$(vYearBefore_Month+2)},Month={$(vMois+2)},[Top]={"O"}>}[OD-Sales]),
((sum({<Year={$(vCurrentYear)},Month={$(vCurrentMonth)},[Top]={"O"}>}[OD-Stock value])-sum({<Year={$(vYearBefore_MonthAfter)},Month={$(vMonthAfter)},[Top]={"O"}>}[OD-Sales]))*30
/sum({<Year={$(vYearBefore_Month+2)},Month={$(vMois+2)},[Top]={"O"}>}[OD-Sales]))+30
))
I can't do this test on the script, because the value depend of selection in application.
The variables vCurrentYear, ... are calculated with the current selection.
Thanks for your suggestions.
Sophie