5 Replies Latest reply: May 11, 2013 9:48 AM by Faisal Mehmood RSS

    How to do Group by for cusotm field with if condition

    Faisal Mehmood

      Please help me here. how can i achieve group by clasue for custom fields.

       

      LOAD DivisionKey,
           Division,
           Region ,
           SubsidiaryKey,
           Subsidiary,
          if ( SubsidiaryKey = 'HHR','A1',CategoryKey) as CategoryKey,
          if ( SubsidiaryKey = 'HHR','Oral Care',Category) as Category,
          if ( SubsidiaryKey = 'HHR','1Z',SubCategoryKey) as SubCategoryKey,
          if ( SubsidiaryKey = 'HHR','Mixed oral Care',SubCategory) as SubCategory, 

         
         
           sum([Inventory Value]) as [Inventory Value] ,
         
      Resident [Inventory Raw_Tmp]

      Group by DivisionKey,
           Division,
           Region,
           SubsidiaryKey,
           Subsidiary,
           if ( SubsidiaryKey = 'HHR','A1',CategoryKey) as CategoryKey,
          if ( SubsidiaryKey = 'HHR','Oral Care',Category) as Category,
          if ( SubsidiaryKey = 'HHR','1Z',SubCategoryKey) as SubCategoryKey,
          if ( SubsidiaryKey = 'HHR','Mixed oral Care',SubCategory) as SubCategory,     
          //CategoryKey,
          //Category,
          // SubCategoryKey,
          // SubCategory,