Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
chinnukool
New Contributor III

set analysis to calculate last month's value

Hi,

I have below user counts and I'm trying to display these in 2 separate text boxes, one for current month and the other one to show last month's value.

Current Month = 4

Last Month = 23

Current Month

=count({<DATE ={">=$(=Date(monthstart(Max(DATE)),'MM-DD-YYYY'))"}>} distinct USERID)

Result = 4

Last Month

=count({<DATE ={">=$(=Date(AddMonths(monthstart(Max(DATE)),-1),'MM-DD-YYYY')) < $(=Date(monthstart(Max(DATE)),'MM-DD-YYYY'))"}>}distinct USERID)

Result = 27 (above expression is doing 23+4)

Can someone please help me calculate last month's data right as 23?

Thanks!

1 Solution

Accepted Solutions

Re: set analysis to calculate last month's value

May be remove the spaces around '<'

=Count({<DATE = {">=$(=Date(AddMonths(MonthStart(Max(DATE)),-1),'MM-DD-YYYY'))<$(=Date(MonthStart(Max(DATE)), 'MM-DD-YYYY'))"}>} DISTINCT USERID)

1 Reply

Re: set analysis to calculate last month's value

May be remove the spaces around '<'

=Count({<DATE = {">=$(=Date(AddMonths(MonthStart(Max(DATE)),-1),'MM-DD-YYYY'))<$(=Date(MonthStart(Max(DATE)), 'MM-DD-YYYY'))"}>} DISTINCT USERID)