Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Champion
Champion

Expression for current year how to write for last yr

Dear all

Following are  my expression for showing current year stock value using avg clause , Now Same thing I want to display for LAST YEAR SAME PERIOD

How to achieve the same.

=SUM(AGGR(

(

(SUM({$<FinancialYear=,Quarter=,MonthName=,[Posting Date] ={"<=$(=MonthEnd(Max([Posting Date])))>=01/04/2012"},[Inv Flag]={0,1,3,5}>}QTY_SIGNED) /* Closing Qty of prev month*/

-

SUM({$<FinancialYear=,Quarter=,MonthName=,[Posting Date] ={"<=$(=MonthEnd(Max([Posting Date])))>=01/04/2012"}>}[Sales Invoice Qty]) /*sales Qty from 1/4/12 till date*/

-

SUM({$<FinancialYear=,Quarter=,MonthName=,[Posting Date] ={"<=$(=MonthEnd(Max([Posting Date])))>=01/04/2012"}>}[Sales Bonus Qty]) /*sales Bon Qty from 1/4/12 till date*/

+

SUM({$<FinancialYear=,Quarter=,MonthName=,[Posting Date] ={"<=$(=MonthEnd(Max([Posting Date])))>=01/04/2012"},[Sales Return Type Code]={0}>}[Sales Return Qty]) /*sales Ret Qty from 1/4/12 till date*/

+

SUM({$<FinancialYear=,Quarter=,MonthName=,[Posting Date] ={"<=$(=MonthEnd(Max([Posting Date])))>=01/04/2012"},[Sales Return Type Code]={0}>}[Sales Return Bonus Qty]) /*sales Ret Bon Qty from 1/4/12 till date*/

)

*avg([Stat Rate Inv]))/100000

,[Product Batch Code],[Location Code],[Product Code],[Expiry Date]))

1 Reply
Highlighted
Creator
Creator

Re: Expression for current year how to write for last yr

Hello

Try this:

=

Sum({<Ano= {$(=year(max(DATA_REFERENCIA))-1)},

        [Semana Ano+Dia Semana Num]= {">=$(=min({<Ano= {$(=year(max(DATA_REFERENCIA)))},

                                                 Mês= {$(=month(max(DATA_REFERENCIA)))} >}[Semana Ano+Dia Semana Num]))"} -

                                                

                                     {"> $(=max({<Ano= {$(=year(max(DATA_REFERENCIA)))},

                                                 Mês= {$(=month(max(DATA_REFERENCIA)))} >}[Semana Ano+Dia Semana Num]))"},       

        DATA_REFERENCIA=,

        Dia            =

        >} PRECO_LIQUIDO)