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

prev month sum, last month , comparison last month data

Hi guys,

I need to calculate sum of views for the previous month based upon the current month selection. I use the expression below but it does not work.

.

=sum({<Month={'$(=(vprevMonth))'}>}Views). It gives the count as 0.

The variable vprevMonth is set as left(MonthName(AddMonths(Date,-1)),3)

Kindly help me with this. Urgent!

Thanks a ton!

2 Replies
sushil353
Master II
Master II

HI,

it seems the problem is with left function .. it will return date as string.

try to use date# function as date#(MonthName(AddMonths(Date,-1)) 'MMM')

make sure the date format should be same as Month field..

other this with expression is =sum({<Month={'$(vprevMonth)'}>}Views)...

HTH

Sushil

somenathroy
Creator III
Creator III

Hi,

Take the approach as:

=sum({<Month={'$(=Month(AddMonths(Date(Max(Date),'DD/MM/YYYY'), - 1)))'}>}Views)

Regards,

Som