Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Contribution % - MAT, YTD, MTD for PreviousYear

Hye folks,

I am trying to figure out how to script the contribution % for previous years.

Any ideas?

Best Regards,

Ram

7 Replies
Not applicable
Author

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')

Not applicable
Author

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.

Not applicable
Author

Try Like this

=max(Year(date(CommonDate,'DD/MM/YYYY'))-1)

Not applicable
Author

try this  {"=$(=Max(Year)-1)"}

Not applicable
Author

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

Not applicable
Author

Hi Thomas,

Doesn't work. Syntax error.

Not applicable
Author

try this:

=sum({<Year={$(=only(Year)-1)}>} measure )