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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count Previous Month

Hi All,

I have an expression below to select data for the current month

count({<DateRaised={"=(MonthName(addmonths(today(),0))" },ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

I know the Month function works as I have used it on labels but for some reason I am getting no numbers back from the expression but it validates?

I have attached the qv file and the elements are on the sheet two tab. Any help would be greatly appreciated!

Toby

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

This formula should work:

=Count({<DateRaised={"=MonthName(DateRaised) = MonthName(addmonths(today(),-2))" },ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

View solution in original post

6 Replies
sunny_talwar
MVP
MVP

Date raised is a timestamp field like this (DD/MM/YYYY hh:mm:ss) and you are comparing it to a MonthYear field. This won't work. You will get a result if you compare the same formats.

Not applicable
Author

Thanks sunindia

I did wondered if it might be a format issue. I have a DateraisedIMS formatted to dd/mm/yyyy, how do I then match it up?

sunny_talwar
MVP
MVP

This formula should work:

=Count({<DateRaised={"=MonthName(DateRaised) = MonthName(addmonths(today(),-2))" },ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

Not applicable
Author

Fantastic, thank you Sunindia

sunny_talwar
MVP
MVP

Please find attached your application. You will see 0 for May and Apr because there are no ValueID available for those period, but March has 4 ValueID

HTH

Best,

Sunny

sunny_talwar
MVP
MVP

No Problem.