Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ramcena306
Creator II
Creator II

How to exclude latest month from variable?

Hi All,

PFA variable, I have a variable which shows 24M (Months)stock values.

how to adjust this variable to exclude the latest month?

stalwar1loveisfailsureshqvjontydkpiarvind1494kush141087

11 Replies
jyothish8807
Master II
Master II

Try this:

sum({1<

CALYEAR= {"$=(max(year))"} , CALMONTH={*}-{"$=(Date(Max(Month),'MMM'))"}

,PROD_CALMONTH=$::PROD_CALMONTH

,PROD_CALYEAR=$::PROD_CALYEAR

>}MON24)

I would recommend to use a Date filed instead of using Year and  month field.

You have define if you are using "Prod_Cal" month or just "cal month" fields for your analysis.

Br,

KC

Best Regards,
KC
sasiparupudi1
Master III
Master III

Try something like below

v_KPI_Stock_24M_Precalc ::

sum(

//basic calculation for 24 month stock based on precalculated MON24

//fields to be considered for selections

{1<

CALMONTH=$::CALMONTH

,CALYEAR=$::CALYEAR

,PROD_CALMONTH=$::PROD_CALMONTH

,PROD_CALYEAR=$::PROD_CALYEAR

     >-1<CALMONTH={"$(=Date(MonthStart(Today()), 'MM'))"},CALYEAR={"$(=Year(Today()))"}>

}

     MON24)