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
ketan vinodrai mehtaketan vinodrai mehta 

SAQL - Expected next sequence error

Hi All,
    I want to plot data using einstain timeseries. For particular customer we may not have data for some months. While running the below SAQL, we are getting error as Expected next sequence [2019 02] but got [2019 04] in partition value "abcd". Despite using fill feature we are getting it.

q = load "All_New_Case_Data";
q = group q by ('CreatedDate_Year', 'CreatedDate_Month', 'Merchant_Wholesaler_Name__c');
q = foreach q generate 'CreatedDate_Year' as 'CreatedDate_Year' , 'CreatedDate_Month' as 'CreatedDate_Month', 'Merchant_Wholesaler_Name__c' as 'Merchant_Wholesaler_Name__c', coalesce(count(),0) as 'Case_count';
q = fill q by (dateCols=('CreatedDate_Year', 'CreatedDate_Month', "Y-M"));
q = timeseries q generate 'Case_count' as estimate with (length= 12, dateCols=('CreatedDate_Year','CreatedDate_Month',"Y-M"), partition ='Merchant_Wholesaler_Name__c');
q = foreach q generate 'CreatedDate_Year' + "~~~" + 'CreatedDate_Month' as 'CreatedDate_Year~~~CreatedDate_Month', 'Merchant_Wholesaler_Name__c' as 'Merchant_Wholesaler_Name__c', 'estimate', 'Case_count';
q = order q by 'CreatedDate_Year~~~CreatedDate_Month' desc;
q = limit q 12000;

Please guide ASAP.
Best Answer chosen by ketan vinodrai mehta
ketan vinodrai mehtaketan vinodrai mehta
Hi All,
     The issue has been resolved by adding the partition clause to timeseries as below: 
q = timeseries q generate 'Case_count' as estimate with (length= 12, dateCols=('CreatedDate_Year','CreatedDate_Month',"Y-M"), partition ='Merchant_Wholesaler_Name__c'); 

All Answers

ketan vinodrai mehtaketan vinodrai mehta
The error is occuring in the below line:
q = timeseries q generate 'Case_count' as estimate with (length= 12, dateCols=('CreatedDate_Year','CreatedDate_Month',"Y-M"), partition ='Merchant_Wholesaler_Name__c');
ketan vinodrai mehtaketan vinodrai mehta
Hi All,
     The issue has been resolved by adding the partition clause to timeseries as below: 
q = timeseries q generate 'Case_count' as estimate with (length= 12, dateCols=('CreatedDate_Year','CreatedDate_Month',"Y-M"), partition ='Merchant_Wholesaler_Name__c'); 
This was selected as the best answer
Tia Joseph @ VenaTia Joseph @ Vena
I added the fill and I added the partition clause to the timeseries. Still, I get this "expected next sequence error". Please help! Any other suggested solutions?