Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
UserID2626
Partner - Creator III
Partner - Creator III

last 6 months data as Dimension Qlik sense

I have 2 years of data, and i am creating one Pivot Table where

            Category is Row,

           Month from date('MM/DD/YYYY') is Column and

           sum(amount) is measures.

 

I need to see last 4 months from the Report Running date or selecting a date from filter, Please help how to show only 4 Months data in Pivot Table.

 

Thanks,

6 Replies
sunny_talwar

Would you be able to provide a sample to help you better?
UserID2626
Partner - Creator III
Partner - Creator III
Author

Sorry, I cant able to provide sample.

I just need a column expression for getting 4 Months data from 2 yrs data.

Thanks,

OmarBenSalem

change ur measure from 

sum(Value) 

 

to sum({<Date={"<=$(=date(max(Date),'MM/DD/YYYY'))>=$(=date(monthstart(addmonths(max(Date),-5)),'MM/DD/YYYY'))"}>}Value)

dwforest
Specialist II
Specialist II

I added a column to my calendar to make this easy and flexible....
Round((num(monthstart(Today(1))-num(monthstart(Date(TempDate)))))/30) AS MonthsFromCurrent
Then in your set expression is just
Sum({$<MonthsFromCurrent={"<5"}>} Value)
UserID2626
Partner - Creator III
Partner - Creator III
Author

this is working, But when selecting the particular month, the data in dashboard should change accordingly.

If i am selecting the month September in filter pane the result should be last 6 months from September(Apr,May,June,july,August& September data).

Help me to achieve this.

dwforest
Specialist II
Specialist II

Something like this (untested):
Sum({$<MonthsFromCurrent={">$(Max(=MonthsFromCurrent))<$(=Max(MonthsFromCurrent)+6)"}>} Value)