Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Gowtham174
Creator
Creator

Previous Month Expression

Hi All,

can you please help me to populate previous month values, for the below sample set of data

data set

QtyMonth
101-01-2018
202-02-2018
303-03-2018
404-04-2018
505-05-2018
606-06-2018
707-07-2018
808-08-2018
909-09-2018
1010-10-2018
1111-11-2018
1212-12-2018

Thanks,

Gowtham

14 Replies
isingh30
Specialist
Specialist

Put -1 after max month in your expression. You can use previous function as well.

Month minus previous month | Qlik Community

Thiago_Justen_

As Ishtdeep already said:

Num(Sum({<Month={"$(=Max(Month)-1)"}>}Qty))



Let's do this:

Sum({<Month={">=$(=MonthStart(AddMonths(Month,-1)))<=$(=MonthEnd(AddMonths(Month,-1)))"}>}Qty)

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
shiveshsingh
Master
Master

Try this

F:

load *,Year(Date) as Year, Month(Date) as Month;

D:LOAD * INLINE [

   

    Qty, Date

    1, 01-01-2018

    2, 02-02-2018

    3, 03-03-2018

    4, 04-04-2018

    5, 05-05-2018

    6, 06-06-2018

    7, 07-07-2018

    8, 08-08-2018

    9, 09-09-2018

    10, 10-10-2018

    11, 11-11-2018

    12, 12-12-2018

];

Previous Month Expression

=sum({<Year = {"=max(Year)"}, Month={"$(=month(MonthStart(max(Date))-1))"}>}Qty)

Gowtham174
Creator
Creator
Author

Hi Shivesh,

Can you please provide me in expression without editing the script.

Thanks,

Gowtham

Gowtham174
Creator
Creator
Author

This expression showing 0 values

Gowtham174
Creator
Creator
Author

i tried with but its not showing the result

Num(Sum({Month={"$(=Max(Month)-1)"}>}Qty))

arvind1494
Specialist
Specialist

Sum({Month={"$(=Max(Month),-1)"}>}Qty)


try this

Gowtham174
Creator
Creator
Author

I tried with same but still not result

Sum({Month={"$(=Max(Month),-1)"}>}Qty)

arvind1494
Specialist
Specialist

sorry i made small mistake

use this:

Sum({Month={"$(=Max(Month,-1))"}>}Qty)