Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hye folks,
I am trying to figure out how to script the contribution % for previous years.
Any ideas?
Best Regards,
Ram
Hi Try This... Hope This will help you
YTD & PrevYTD
=sum({<CommonDateField={'>=$(VPrevYear)<=$(vMaxDate)'}>}Sales)
VPrevYear=Date(Yearstart(vMaxDate,-1),'DD/MM/YYYY')
For MTD Prv MTD
=sum({<CommonDateField={'>=$(VPrevMonth)<=$(vMaxDate)'}>}Sales)
Variables:
VPrevMonth=Date(MonthStart(vMaxDate,-1),'DD/MM/YYYY')
vMaxDate=Date(max(CommonDateField),'DD/MM/YYYY')
Hi Nirmal,
Sorry - your explanation is kinda vague. A more descriptive clarification would be appreciated.
My main concern is how do I create a <$Year={(MAX)Year - 1> variable?
This would definitely help me out, put me on the right path.
Much appreciated.
Try Like this
=max(Year(date(CommonDate,'DD/MM/YYYY'))-1)
try this {"=$(=Max(Year)-1)"}
if you use many YTD and comparison vs previous year, you can
1) use complex set analysis (take care, you must have only ONE year in your graph)
2) modify your model (you can have several months & years in your graph)
see a doc I have written on that subject : http://community.qlik.com/docs/DOC-4821
Fabrice
Hi Thomas,
Doesn't work. Syntax error.
try this:
=sum({<Year={$(=only(Year)-1)}>} measure )