function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mitesh JainMitesh Jain 

SAQL Bucketing along with Sum of Count of Rows

Hi Team,

I am looking to Bucket a field and want to sum the row count for that bucket field in SAQL. Can anybody help me on this.
 

SAQL  -
q = load "Huntsman_Orders_with_Clients_New";
q = filter q by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["current year".."current year"];
q = filter q by 'RecordTypeId.Name' == "Bespoke Item";
q = group q by ('Production_Type__c');
q = foreach q generate 'Production_Type__c', 
case 
when 'Production_Type__c' in ["Baste"] then "B1849"
else
"B100"
end as 'Bucket Production_Type__c', sum(Count_of_Order__c) as 'count';
q = foreach q generate count as 'count','Bucket Production_Type__c' as 'Bucket Production_Type__c';
q = order q by ('Bucket Production_Type__c' asc);
q = limit q 2000;

What i want is B1849 - 211

B100 - 44+41+31+14+1+175 = 306

User-added image