Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Group By Date

You can group the result of your SAQL query by DateTime and DateOnly fields.
1q = group q by 'CloseDate';

CloseDate can be DateTime or DateOnly. You can also group by date parts. For example, you can group orders by year and then month.

1q = group q by year('OrderDate'), month('OrderDate');

You can use the DateTime or DateOnly field to cogroup two datasets. For example, you can group two datasets by year.

1a = load dataset1;
2b = load dataset2;
3c = group a by year('CloseDate'), b by year('CloseDate');
4e = foreach c generate year(a.'CloseDate') as 'CloseDate A', year(b.'CloseDate') as
5'Close Date B', sum(a.Amount) as 'Sum of Amount';