2 Replies Latest reply: Sep 3, 2010 6:59 PM by John Witherspoon RSS

    Class function with variable

      I am trying to use the class funtion to count the number of purchases in different brackets. I have written the following in the calculated dimension

      =class(PurchaseValue,vWidth,'Purchase Size')

      The problem i have is that i just can't take the purchase value direct from the data source as i need to exclude a few entries to get the correct number. To do this i have written the below variable

       

      vpurchase = Reregistration={No},Switch={No}

      This variable works but i am stuck as to how i encorporate the variable into the class function.

       

      I have tried the below but it doesn't work can someone help?

      =class((vpurchase)PurchaseValue,vWidth,'Purchase Size')



        • Class function with variable
          John Witherspoon

          I think this?

          =class(aggr(only({<Reregistration={'No'},Switch={'No'}>} PurchaseValue),PurchaseValue),vWidth,'Purchase Size')

          Or if you really want to use your variable, probably this?

          =class(aggr(only({<$(vpurchase)>} PurchaseValue),PurchaseValue),vWidth,'Purchase Size')

            • Class function with variable
              John Witherspoon

              Though it might be easier, and would likely run faster, if you create a "No Reregistration No Switch Purchase Value" field, whatever you want to call it.

              if(Reregestration='No' and Switch='No',PurchaseValue) as "No Reregistration No Switch Purchase Value"

              =class("No Reregistration No Switch Purchase Value",vWidth,'Purchase Size')