Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dhineshwaran
Contributor II
Contributor II

Previous 'N' Month calculation

Hi,

The requirement is, when I select a particular month say 'March' for an year say '2020', All the previous months must also be displayed say 'Jan','Feb' and 'March'. How could i achieve this?   Please help me out.

11 Replies
Dhineshwaran
Contributor II
Contributor II
Author

Hi Vegar,

Can you help me to sort out this issue?

 

 

Regards,

Dhinesh

(+91) 9894024763

Vegar
MVP
MVP

Check out the attached qvf file.

Vegar_1-1595407327454.png

In top chart I'm using 

=sum({<
   //[YEAR] = {'$(=Max(YEAR))'},
   [MONTH]={"<=$(=Max(MONTH))"},
   [XXBI_GL_GROUP_BALANCE_V.DISPLAY_FLAG]= {"Y"},
   [XXBI_GL_GROUP_BALANCE_V.ACCT_GROUP_NAME] = {"Revenue"}>}
[XXBI_GL_GROUP_BALANCE_V.PTD_VALUE])

In the bottom chart 

=sum({<
   [YEAR] = {'$(=Max(YEAR))'},
   [MONTH]={"<=$(=Max(MONTH))"},
   [XXBI_GL_GROUP_BALANCE_V.DISPLAY_FLAG]= {"Y"},
   [XXBI_GL_GROUP_BALANCE_V.ACCT_GROUP_NAME] = {"Revenue"}>}
[XXBI_GL_GROUP_BALANCE_V.PTD_VALUE])

 

Notice that when logical comparing using <= on [MONTH] I use Max() not MaxString() as I don't want to logical compare the string value.