Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Buonasera,
Vorrei sapere come fare ad eseguire una somma solo degli ultimi 4 mesi relativi ad una quantità già presente in ognuno dei 12 mesi, esempio:
Media pezzi venduti per articolo negli ultimi 4 mesi, in Excel vado a selezionare direttamente le colonne interessate degli ultimi quattro mesi, ma in QLIK non riesco a farlo.
Vi ringrazio anticipatamente
Michele
Best and fast solution is to create an indicator in the script like this -
if(monthend([Trans Date]) >= monthend(addmonths(Today(1),-4)) and monthend([Trans Date]) < monthend(Today(1)), 1,0) as Last_4months_ind
and then in the expression use it like this -
Sum({<Last_4months_ind = {1}>}Quantity)
You might need to adjust the expression based on your needs as such whether you need running month included or not.
If you need to select last 4 months based on your selection made in the period related field, then you need to move your script solution to 'Sum' expression but that needs to be coded differently.
Thanks,
Ok, grazie per la risposta, volvevo sapere se al posto di "Trans Date" e "Today" devo scrivere qualcosa di diverso?
Trans Date should be replaced with your data model date field that is used for the period calculation. Today(1) is the current date. The expression I shared, goes back 4 months from the End of the day of last month. it doesn't include the running month days.