# Community Corner

Discussion board for questions about the Qlik Community, its features, sharing information, general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Partner

## Standard expression for last twelve months

I have a scenario , need to prepare a standard expression for

1.Monthly

2. YTD

3.Last twelve months

sum({<\$(vCYPeriod),Scenario={'CPL_ACT'}>}Value) [STANDARD FORMULA]

vCYPeriod=Pick(match(\$(vPeriodType),1,0,2),vPeriodTypeCYMTH,vPeriodTypeCYYTD,vPeriodTypeLast12Months)

vPeriodTypeCYMTH=[Fiscal year]={'\$(=\$(vCurrYear))'},[Posting period]={'\$(=\$(vCurrMonth))'}

vPeriodTypeCYYTD=[Fiscal year]={'\$(=\$(vCurrYear))'},[Posting period]={"<=\$(=\$(vCurrMonth))"}

vCYPeriod changes as per I select the variable as Monthly,YTD and Last twelve months. For Last twelve months the formula  is

<[Fiscal year]={'\$(=\$(vLast12MonthsStartYear))'},[Posting period]={">=\$(=\$(vLast12MonthsStartMonth))"}> + <[Fiscal year]={'\$(=\$(vCurrYear))'},[Posting period]={"<=\$(=\$(vCurrMonth))"}>

 vLast12MonthsStartMonth if(\$(vCurrMonth)=12,1,\$(vCurrMonth)+1) vLast12MonthsStartYear if(\$(vCurrMonth)=12,\$(vCurrYear), \$(vPrevYear))

Can someone help me to modify the expression in such a way, so that it can be used in the standard format , i.e mentioned above.

Labels (1)