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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

Month on Month

I need to make a month on month comparison(i.e Mar 2012 - Feb 2012, Jan 2012 - Dec 2011 data on pivot table, this is the code on my dimension to extrapolate the value on the current month, therefore Month_Year have to be on the dimension

=IF ( Date > AddMonths (  ( var_EndDate ) , (-var_PeriodInYears * 12) ) ,

if( MonthEnd(Date) <> var_EndDate

AND MonthEnd(Date) = MonthEnd(var_EndDate)

, '*' & Month_Year, Month_Year) )

This is my code for my expression

=if( MonthEnd ( MAX( Date ) ) <> var_EndDate AND MonthEnd( MAX ( Date ) )
= MonthEnd( var_EndDate ) ,


(

(
  sum({$<Year = {$(v_ThisYear)}, Loading = {'ID*'}>} TEU)
  -
  sum({$<Year = {$(v_ThisYear)},Loading = {'ID*'}>} TEU)
)


/ Day( var_EndDate )) * Day(MonthEnd(MAX ( Date )) * 100

)

,

((sum({$<Year = {$(v_ThisYear)},Loading = {'ID*'}>} TEU)
-
sum({$<Year = {$(v_ThisYear)},Loading = {'ID*'}>} TEU)))

)

I am thinking of using this code to make MOM comparison but it is not working

AddMonths(Date,-1)

Is there any code that works something like this?


0 Replies