1 Reply Latest reply: Sep 11, 2015 3:05 PM by Sinan Ozdemir RSS

    Create Pivot Table in Load Script

    Yvonne Han

      Hi QV Expert:

       

      I'm trying to create a pivot table in the load script because I need to add other calculation in the front end. My source data is in chart 1. The processed table should look like chart 2, with columns…

      • Preferred (N)/ Preferred (Y): the count of sellers that are labeled N/Y in the Preferred column in chart 1.
      • % of Preferred: Preferred (Y)/(Preferred (Y)+Preferred (N))
      • Has Preferred?: Y if Preferred (Y)> 0

       

      Can someone help with the script? I was using  "if (Preferred= 'Y', Count ([Seller]),0) as 'Preferred (Y)'" for Preferred (Y),   but it didn't seem to work…

       

      Thanks!

       

      chart 1  

      ItemSellerPreferred Seller
      AppleFarm AY
      AppleFarm CN
      OrangeFarm CN
      OrangeFarm AY
      OrangeFarm BN
      PearFarm BN
      PearFarm AY
      Watermelon Farm BN
      Watermelon Farm DN

       

      Chart 2   

         

      ItemPreferred (N)Preferred (Y)% of PreferredHas preferred?
      Apple1150%Y
      Orange2133%Y
      Pear1150%Y
      Watermelon 200%N