Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Issue

Hi,

I have a field YearValue which has values such as 1-2014, 2-2014 etc. I wish to calculate last 12 months from 2 -2014 which would be 2 -2013. and store it in a variable. How do i do the same?

Thanks,

Asma

4 Replies
tresesco
MVP
MVP

One value value - last 12th month, right? If so then then try like:

=Date(AddMonths(MakeDate(SubField(YearValue, '-',2), SubField(YearValue,'-',1)) , -12), 'MM-YYYY')

Update: Corrected

Not applicable
Author

How do i find out the last 12th month? In this case, when we are selecting a value from the YearValue filed, then we are able to see the last 12th month.

e.g. currently we are in Sep 2014, so last 12th month should be displayed as Sep 2013 in a text box.

anbu1984
Master III
Master III

=SubField('Sep 2014',' ',1) & ' ' & (SubField('Sep 2014',' ',2)-1)

ecolomer
Master II
Master II

see this example