Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
i have to show Max Month Sales, previous month sale and previous to previous month sales.
i created 3 variables
vMaxMonth = max(Month) /// month value are in number
vlastMonth = Max(Month)-1
vlast2lastMonth = Max(Month)-2
now i am using variable in this way.
=sum({< Month = {$(vMaxMonth)}>}sales
=sum({< Month = {$(vlastMonth )}>}sales
please correct me it is not working
Try this..
vMaxDate=max(Date)
vMaxMonth = month(vMaxDate)
vlastMonth =addmonths(vMaxDate,-1)
vlast2lastMonth =addmonths(vMaxDate,-2)
I assume there is a Date column
what would be the syntax??
Let the expressions be same.. just change the variable definitions
this worked:
vMonthMax: =max(month)
vMonthMax1: =max(month) - 1
vMonthMax2: =max(month) - 2
sum({<month = {$(vMonthMax)}>} sum)
sum({<month = {$(vMonthMax1)}>} sum)
sum({<month = {$(vMonthMax2)}>} sum)
max month working but last and last 2 last month not working
Alexandra, this is the same i was doing but not working.. not able to understand why
can you share the sample qvw file? 'cos it worked for me perfectly
Abhay,
I think if you change the definition of these variables to
vlastMonth =month(addmonths(vMaxDate,-1))
vlast2lastMonth =month(addmonths(vMaxDate,-2))
..then it will work. Just try and let me know
Regards,
Dawar
Refer the attached application
You just need to create 2 variables for MinDate and Max Date