3 Replies Latest reply on Jan 1, 2014 1:22 PM by Joshua Milligan

    Use a Calculated Field as a Quick Filter

    jabrane.belghith

      Hello;

       

      How Can we use a calculated field like a filter that conatin two values , " Vide" or " Complet" . The calculated field is :

       

      VIDE_Complet = iif(count(Student)=0,'Vide','Complet')

        • 1. Re: Use a Calculated Field as a Quick Filter
          Joshua Milligan

          Jabrane,

           

          Unfortunately, you cannot use a discrete aggregate calculation (e.g. COUNT in an IIF that results in string) as a filter.  You can use a continuous aggregate.  So, in your calc above, if you change 'Vide' to 0 and 'Complet' to 1 you should be able to change the field to continuous and then use it on the Filters shelf.

           

          Happy New Year!

          Joshua

          • 2. Re: Use a Calculated Field as a Quick Filter
            jabrane.belghith

            Happy New Year Joshua and Thank you for your reposne;

            I change 'Vide' to 0 and 'Complet' to 1 and Ichange the field to continuous and then use it on the Filters shelf.

            But; Can I after that , display the 0 as 'Vide' and 1 as 'Complet'??

            Thank you again

            • 3. Re: Use a Calculated Field as a Quick Filter
              Joshua Milligan

              Jabrane,

               

              Not directly.  However you could use a parameter.  If you create a parameter like this (note the All option is optional and only if you want to give the option for showing Vide and Complet at the same time):

               

              0.png

               

              Then you can change your calculated field (or create a new one) that uses the parameter values.  It would be something like this:

               

              [VIDE_Complet Filter]

              IF

              [VIDE_Complet Parameter] == -1

              OR

              ([VIDE_Complet Parameter] == 0 AND COUNT(Student) == 0)

              OR

              ([VIDE_Complet Parameter] == 1 AND COUNT(Student) != 0)

              THEN 1

              ELSE 0

              END

               

               

              As a continuous aggregate, you should be able to place that filter calculation on the Filters shelf and keep where it is at least 1.

               

              Regards,

              Joshua

              1 of 1 people found this helpful