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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

last 12 months count

Hi,

Can anyone please help me with simple requirement. I need to show last 12 months count of employees in a pivot table..I do have a date column and the latest month in the database is not the current month..i have tried to use

=count(if(date(floor(datefield))>=$(v11Months) and date(floor(datefield)) <= $(vEnddate),employee))

I'm having timestamp in the date filed so I used floor function to remove timestamp..

where v11months=date(floor(AddMonths(max(datefield),-11)))

and enddate=date(floor(max(OBGRADEAPPROVED),-11))

the solution might be simple and I might be doing in the wrong way..

any help is highly appreciated..

Labels (1)
1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

=count({<DateField={'>=$(=MonthStart(Max(DateField), -11))<=$(=Max(DateField))'}>} Employee)

Hope this helps you.

Regards,

Jagan.

View solution in original post

6 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

=count({<DateField={'>=$(=MonthStart(Max(DateField), -11))<=$(=Max(DateField))'}>} Employee)

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

no luck it is always showing total count..

jagan
Partner - Champion III
Partner - Champion III

Hi,

Can you post sample file.

Regards,

Jagan.

CELAMBARASAN
Partner - Champion
Partner - Champion

Check with this..

Count({<DateField={'>=$(=TimeStamp(MonthStart(Max(DateField), -11)))<=$(=Max(DateField))'}>} Employee)

Not applicable
Author

my bad it was working..if I was selecting a time period,but what if I want to show the data from the past 12 months from the latest month always..

jagan
Partner - Champion III
Partner - Champion III

Hi,

If you have any other date filters like Month, Year, Quarter then use like thi

=count({<YearField=, MonthField=, QuarterField=, WeekField=, DateField={'>=$(=MonthStart(Max(DateField), -11))<=$(=Max(DateField))'}>} Employee)

Hope this helps you.

Regards,

Jagan.