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: 
UserID2626
Partner - Creator III
Partner - Creator III

Display last 6 month by selecting a month in filter pane Qlik Sense

Hi,

I have 24 months data(2018 & 2019), Need to create a pivot table.

Dashboard should display last 3 months data and if i select a month 2019-march, dashboard should display 2019-march,2019-Feb,2019-Jan. If i select 2019-Jan,dashboard should display 2019-Jan,2018-Dec,2018-Nov.

How to achieve this.

Dimension:

Product

S_date

Metric:

Revenue

Thanks in advance 🙂

Labels (3)
1 Solution

Accepted Solutions
Prink
Contributor III
Contributor III

Hi,

 Try by using below expressions

Dimension:

     Product

Measure: 

    Sum ({< YearMonth= {">=$(=Date (AddMonths (Date (YearMonth,'YYYY-MMM'),-5),'YYYY-MMM')) <=$(=Date (YearMonth,'YYYY-MMM'))”}>} Revenue)

Column Condition:

    aggr(only({<YearMonth={">=$(=date(monthstart(addmonths(YearMonth,-5)),'YYYY-MMM'))<=$(=date(YearMonth,'YYYY-MMM'))"}>}YearMonth),[YearMonth])

 

I haven't used max function in date fields, by using max function I am always getting (max month -6) month result. But the issue is by using above expression my pivot table showing result as null, so result will be shown only when selecting a month filter pane.

If need to show something when end user opening dashboard, having two options

1)  Setting default bookmark - https://help.qlik.com/en-US/sense/February2019/Subsystems/Hub/Content/Sense_Hub/Bookmarks/set-defaul...

2) Always one selected value - https://help.qlik.com/en-US/sense/February2019/Subsystems/Hub/Content/Sense_Hub/DataSource/select-si...

View solution in original post

12 Replies
santho_ak
Partner - Creator III
Partner - Creator III

Try adding a year-month filter based on your need. Qlik sense allows you to select multiple values at a time.  (attached snapshot for reference)

Capture.PNG

If you are looking for help in creating a pivot table : Qliksense Pivot table

 

Do let us know with more details, if you need additional help.

 

Regards,

Santhosh Ashokkumar

JordyWegman
Partner - Master
Partner - Master

Hi Nivetha,

You can't do this when selecting a month. Because the engine can't know that you want three months. A possibility is, when you use the Qlik Sense February update, that you use the Variable Input. In this variable you make the selection 'Selected month' till 'Selected month - 3'.

Jordy

Climber 

Work smarter, not harder
UserID2626
Partner - Creator III
Partner - Creator III
Author

i can see 3 months data in dashboard by using below expression
sum({<S_date={"<=$(=date(max(S_date),'MM/DD/YYYY'))>=$(=date(monthstart(addmonths(max(S_date),-3)),'MM/DD/YYYY'))"}>}Revenue)

But when selecting particular month(2019-jan) in filter pane, i am not getting past three month from selected month.



miskinmaz
Creator III
Creator III

Hi,

Make sure if you are giving the year selection in front end then nullify the Year in your set analysis as well.

If this is not the case then please share the sample app.

Channa
Specialist III
Specialist III


=SUM({$<YoureDateField = {'>=$(=AddMonths( MontStart (Today()),-6))<$(=Monthhend(Max(date))'}>}Sales)

 

if you have date this expression will go back 6 months from selected month

Channa
UserID2626
Partner - Creator III
Partner - Creator III
Author

Hi Miskinmaz,

Attached my app and sample data.

miskinmaz
Creator III
Creator III

Hi

Please create the new field 

date(MonthStart(S_date),'YYYY-MMM') as YearMonth

and use this field in set analysis and dimension.

 

 

UserID2626
Partner - Creator III
Partner - Creator III
Author

Created field in script and used year month in my column expression, but still i am not getting expected result.

aggr(only({<S_date={">=$(=date(monthstart(addmonths(max(S_date),-5)),'DD/MM/YYYY'))"}>}YearMonth),[YearMonth])

please share sample app for reference.

santho_ak
Partner - Creator III
Partner - Creator III

Try something like this:
Count({$<S_date = {">=$(=vMaxMonth-2)<=$(=vMaxMonth)"}, Month>} Number)