Skip to content

Instantly share code, notes, and snippets.

@escgeek
Created March 25, 2017 16:32
Show Gist options
  • Save escgeek/d891358631e04e0c9e324f49a7368168 to your computer and use it in GitHub Desktop.
Save escgeek/d891358631e04e0c9e324f49a7368168 to your computer and use it in GitHub Desktop.
q = load "0Fb44000000btGwCAI/0Fc44000000cKRmCAM";
q = filter q by 'Compensatory__c' == "true" && 'Business_Unit__c' == "";
q = group q by ('Business_Unit__c', 'New_Product_Tracking_Name__c');
q = foreach q generate 'Business_Unit__c' as 'BU', 'New_Product_Tracking_Name__c' as 'NPT', sum('Sales__c') as 'Total_Sales';
q = order q by ('BU' asc, 'NPT' asc);
o = load "opportunity";
o = filter o by 'IsClosed' == "false";
o = filter o by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["current year".."current year"];
o = group o by ('Business_Unit_Formula__c', 'New_Product_Tracking_Name__c');
o = foreach o generate 'Business_Unit_Formula__c' as 'BU', 'New_Product_Tracking_Name__c' as 'NPT', sum('Current_Year_Amount__c') as 'Opp_Total_Sales';
o = order o by ('BU' asc, 'NPT' asc);
u = cogroup o by ('BU','NPT'), q by ('BU','NPT');
u = foreach u generate sum(q.'Total_Sales') as 'YTD Sales', sum(o.'Opp_Total_Sales') as 'Pipeline', q.BU as 'Business Unit', q.NPT as 'New Products';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment