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: 
balajisj30
Creator
Creator

Previous month using set analysis in qliksense

Hello people

I have created date field using this expression,

Date( MakeDate( left(acc_period,4) , right(acc_period,2) ) , 'YYYY-MM' )

I have a requirement to display previous month sales based on the selected Date. I used the below exp for previous month sales,

=Sum({$<Date={"$(=Max(Date)-1)"}>}sales)

But it is not working. Please help me to solve this issue.

Date format - YYYY-MM (2018-12)

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

Sum({$<Date={"$(=Date(AddMonths(Max(Date),-1),'YYYY-MM'))"}>}sales)

View solution in original post

5 Replies
krishna20
Specialist II
Specialist II

Hi ,

Derive a separate month field from your Date field and construct your expression .

sasiparupudi1
Master III
Master III

Sum({$<Date={"$(=Date(AddMonths(Max(Date),-1),'YYYY-MM'))"}>}sales)

shubham_singh
Partner - Creator II
Partner - Creator II

Create a column named MonthSerial using


(num#( left(acc_period,4))*12) + num#( right(acc_period,2)) as MonthSerial



then use


=Sum({<MonthSerial={$(=(Max(MonthSerial)-1))}>}sales)


for previous month sales

balajisj30
Creator
Creator
Author

Thanks. Exp is working.

shamiul_islam
Contributor III
Contributor III

What is acc_period in your equation?