2 Replies Latest reply: Aug 28, 2012 10:39 AM by melaniehuggins RSS

    current month

      Hello

       

      I have data like below loaded into QV, how do I write an expression that counts the number of injury in the current month i.e. Aug

      I have already have an expression for the total

       

      count({1<IncidentType={'*Injury*'}>}IncidentType)

       

       

      But I now need to show the total INJURY for the current month regardless of the selection. I know its something to do with month(Today()) but what I have tried is not working.

       

      Thanks for your help

       

       

      IDSiteDateRaisedIncidentType
      17520Site a23/07/2012 09:30Injury
      17609Site a24/07/2012 08:00Injury
      17612Site a25/07/2012 13:00Injury
      17614Site a25/07/2012 15:30Injury
      17689Site a30/07/2012 11:10Injury
      17867Site b01/08/2012 08:30Injury
      17873Site b06/08/2012 15:50Injury
      17874Site b06/08/2012 08:00Injury
      17888Site b06/08/2012 17:30Injury
      17962Site b09/08/2012 15:00Injury
      17986Site b10/08/2012 12:00Injury
      18008Site a10/08/2012 14:00Injury
      18049Site a13/08/2012 10:00Injury
      18076Site c15/08/2012 23:00Injury
      18078Site c16/08/2012 13:55Injury
      18193Site c23/08/2012 09:00Injury
        • Re: current month

          To use set analys you will need to define the months for your data in the script, probably would be best using MonthName(DateRaised) as MonthYearRaised which returns the month and year. then in set analysis you can do:

           

          count({1<IncidentType={'*Injury*'},MonthYearRaised ={$(=Monthname(Today()))}>}IncidentType)

           

          or if you dont want to do that you can do this:

           

          count({1<IncidentType={'*Injury*'}>}if(Monthname(DateRaised)=Monthname(today()),

          IncidentType))

           


          • Re: current month

            this works

             

            count({1<IncidentType={'*Injury*'}>}if(Monthname(DateRaised)=Monthname(today()),

            IncidentType))

             

             

            Thank you