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

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..

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

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.