Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
ashis
Creator III
Creator III

Current and previous month's report count

hello,

I am trying to get count of reports for current month and previous month.

My month is getting calculated from master calender as

Date(MonthStart(Date),'MMM-YY') as Month

now I am writing two variables as

vCurrentMonthCount=count({<Month={"$(=max(Month))"}>}ReportName)
vPreviousMonthCount=count({<Month={"$(=max(Month)-1)"}>}ReportName)


But the previous month calculation is not giving me value. I am not sure
where is my mistake .

Please help.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

A bit correction in brackets is needed.

vPreviousMonthCount=count({<Month={"$(=Date(AddMonths(max(Month),-1),'MMM-YY'))"}>}ReportName)

View solution in original post

7 Replies
arvind_patil
Partner
Partner

Hi Ashis,

Please try Below Expression:

vPreviousMonthCount=count({<Month={'$(=addmonths(max(Month)),-1)'}>}ReportName)


Thanks,

Arvind Patil

ashis
Creator III
Creator III

Thank for the reply, however it is giving me 0 value.

If I am correct addmonths will give the first date of the previous month. eg 1/6/2017 .

Regards,

Ashis

devarasu07
Master II
Master II

Hi,

Can you try like this,

vPrevMonth

=count({<Month={'$(=Month(AddMonths(Today(),-1))'}>}ReportName)

Thanks,Deva

tresesco
MVP
MVP

May be like:

vCurrentMonthCount=count({<Month={"$(=Date(max(Month),'MMM-YY'))"}>}ReportName)

vPreviousMonthCount=count({<Month={"$(=Date(AddMonths(max(Month),-1)),'MMM-YY')"}>}ReportName)

ashis
Creator III
Creator III

Thank you for your reply.

PreviousMonthCount is giving 0 value. However current month is fine.

Regards,

Ashis

tresesco
MVP
MVP

A bit correction in brackets is needed.

vPreviousMonthCount=count({<Month={"$(=Date(AddMonths(max(Month),-1),'MMM-YY'))"}>}ReportName)

View solution in original post

ashis
Creator III
Creator III

Thank you, this works.