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: 
arulsettu
Master III
Master III

calculate previous six month value

hi

i need to calculate previous six month value so i used below code

sum({<ACNT_FLEX_02={'Balance Sheet'},TBAL_CAL_MONTH={'>=$(vTBL_month)'},TBAL_CAL_YEAR={'>=$(Acnt_year)'}>}TBAL_MTD_DR_LC_1-TBAL_MTD_CR_LC_1)

vTBL_month=max(TBAL_CAL_MONTH)-6

Acnt_year=max(TBAL_CAL_YEAR)


TBAL_CAL_MONTH contains value like this

0,1,2,3,4,5,6,7,8,9,10,11,12


what i need is if i select 12th month it should show 6th month value. if i select 6th month it should show previous year 12th month value.


plz anyone suggest some idea


thanks



15 Replies
sushil353
Master II
Master II

Hi,

Create a variable like vMonth = Addmonths(Max(datefield),-6)

then use this variable in your expression like

Sum({<datefield = {">= $(vMonth)"}>}Value)

HTH

Sushil

arulsettu
Master III
Master III
Author

Hi Sushil,

               i did the same but getting zero only am i doing any mistake?

thanks

arulsettu
Master III
Master III
Author

Hi Sushil,

                i am getting the result but it is not correct. its not showing previous six month value. it showing current value

plz suggest

thanks

arulsettu
Master III
Master III
Author

any idea guys?

arulsettu
Master III
Master III
Author

even i select the year its shows only current year

plz check this app and suggest some solutions

thanks

arulsettu
Master III
Master III
Author

any help guys?