Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
sharmasapna
Contributor III
Contributor III

Qlikview Get Current Months Selectionwith Previous adn Previous-1 Year Month Data

Hi Team

I have requirement where user can select a month range. like(Apr2017 to Aug2017), then in that case, bar chart should display 201704 to 201708, 201604 to 201608, 201504 to 201608.

Please find attached qvw for test data.

Thanks in Advance!!!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Something like below.. I hope that you can create variables yourself.

=SUM(

{


<Year=,[Year/Month] = {">=$(=Date(AddYears(Date#(Min([Year/Month]),'YYYYMM'),0),'YYYYMM'))<=$(=Date(AddYears(Date#(Max([Year/Month]),'YYYYMM'),0),'YYYYMM'))"}>

+

<Year=,[Year/Month] = {">=$(=Date(AddYears(Date#(Min([Year/Month]),'YYYYMM'),-1),'YYYYMM'))<=$(=Date(AddYears(Date#(Max([Year/Month]),'YYYYMM'),-1),'YYYYMM'))"}>

+

<Year=,[Year/Month] = {">=$(=Date(AddYears(Date#(Min([Year/Month]),'YYYYMM'),-2),'YYYYMM'))<=$(=Date(AddYears(Date#(Max([Year/Month]),'YYYYMM'),-2),'YYYYMM'))"}>

}

[Total net sales USD])

View solution in original post

3 Replies
YoussefBelloum
Champion
Champion

here it is,

here you should start to evaluate and format your Time related fields in the correct format to avoid doing it in your variables and expressions.

MK_QSL
MVP
MVP

Something like below.. I hope that you can create variables yourself.

=SUM(

{


<Year=,[Year/Month] = {">=$(=Date(AddYears(Date#(Min([Year/Month]),'YYYYMM'),0),'YYYYMM'))<=$(=Date(AddYears(Date#(Max([Year/Month]),'YYYYMM'),0),'YYYYMM'))"}>

+

<Year=,[Year/Month] = {">=$(=Date(AddYears(Date#(Min([Year/Month]),'YYYYMM'),-1),'YYYYMM'))<=$(=Date(AddYears(Date#(Max([Year/Month]),'YYYYMM'),-1),'YYYYMM'))"}>

+

<Year=,[Year/Month] = {">=$(=Date(AddYears(Date#(Min([Year/Month]),'YYYYMM'),-2),'YYYYMM'))<=$(=Date(AddYears(Date#(Max([Year/Month]),'YYYYMM'),-2),'YYYYMM'))"}>

}

[Total net sales USD])

sasiparupudi1
Master III
Master III

Manish Kachhia, you are a legend!