Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
arulsettu
Master III
Master III

how to get last 6 months value

hi

     i need to find last six month value but i have only year and month field alone.

i used this  sum({$<ACNT_FLEX_02={'Balance Sheet'},datefield={">=$(vPrior6)"}>}TBAL_MTD_DR_LC_1-TBAL_MTD_CR_LC_1)

vPrior6= AddMonths(max(datefield),-6)


datefield is MakeDate(TBAL_CAL_YEAR,TBAL_CAL_MONTH) as datefield


but i am not getting last six month values


please help


thanks

17 Replies
anbu1984
Master III
Master III

Check this

arulsettu
Master III
Master III
Author

can you help me to implement this in my app i am doing in pivot table

anbu1984
Master III
Master III

vYear=Year(AddMonths(Date#(Only(TBAL_CAL_YEAR) & '/' & Only(TBAL_CAL_MONTH),'YYYY/MM'),-6))

vMonth=Date(AddMonths(Date#(Only(TBAL_CAL_YEAR) & '/' & Only(TBAL_CAL_MONTH),'YYYY/MM'),-6),'MM')

Expr: Sum({<TBAL_CAL_MONTH={'>=$(vMonth)'},TBAL_CAL_YEAR={$(vYear)}>}TBAL_MTD_DR_LC_1-TBAL_MTD_CR_LC_1)

Not applicable

Then you make the 6 month in a extra dimension, simular as a Quartal. Then you could in the aplikation change the 6 month from 1 - 6 or 7-12.

arulsettu
Master III
Master III
Author

only with in the field have to do no extra dimensions

arulsettu
Master III
Master III
Author

i used below code results are coming but if i select 5th month it showing only blank values it should show previousw year 12th month value

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

what i am doing wrong here some one suggest  me please

thanks

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Responded to here: problem in set analysis

Steve

anbu1984
Master III
Master III

Check this app