Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Previous Month Expression

Hi,

Please can someone help me with calculating the previous month expression.  I have a straight table with number of licenses calculated by:

sum([Total Licenses])

Against this I want to show the same value for the previous month, so I written the below expression:

=sum({$<[Month Key]={$(=[PM Key])}>} [Total Licenses])

[Month Key] is held on every record to show the month e.g. 3_2012. 

[PM Key] is also held on every record to show the previous month e.g. 2_2012.

but not working :-<

Grateful for any assitance with this.

Mike.

14 Replies
Not applicable
Author

Have already tried that - Above only works when the month stay in the correct sort order, and it also goes wrong when the user makes a select that excludes previous month.

Not applicable
Author

The sort order thing is true - are you having problems with that? There are ways around sort problems. However, I have a previous month expression in my code and it continues to function even when the month is restricted. What code are you using?

Not applicable
Author

I am displaying my table horizontally so don't think the Above() function will work for me.

Not applicable
Author

In that case Before() will serve a similar purpose.

Not applicable
Author

Sorry, I am acutally using a pivot table rather than a straight table so Above() or Below() will not work.