Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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
Gowtham174
Creator
Creator
Author

Still not correct its showing -

Thiago_Justen_
MVP
MVP

I guess your month field is not in the date format. Make sure it's not a text field. Test this:

IsNum (Month)

If you get -1 as result, then your field is a numerical one. Otherwise, you must to format it into load script.

Cheers

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Gowtham174
Creator
Creator
Author

yes its -1 how to change it now

Chanty4u
MVP
MVP

try this

sum({<Month={"=max(Month)-1"}>}Qty)

Chanty4u
MVP
MVP

try

a:

load *, month(MyDate) as NewMonth,

date(MyDate) as NewD,

Num(Month(MyDate)) as MonthNum;

LOAD Qty,

     MyDate

FROM

(ooxml, embedded labels, table is Sheet3);

Frontend:

Strighttable

dim: Month

Exp: sum({<MonthNum={"=max(MonthNum)-1"}>}Qty)