Order By Date

You can order the result of your SAQL queries by DateTime or DateOnly.

Use the date part to order by date before the projection. For example, you can order results by the year that they closed.

q = order q by year('CloseDate');

To order by date after the projection, use the field you created by projecting a date part. For example, you can order results by the year that they closed.

q = foreach q generate year('CloseDate') as "Year Closed";
q = order q by 'Year Closed';