Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

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]))

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
1 Reply
offjunior
Creator
Creator

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)