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
Robin BarnwellRobin Barnwell 

Einstein Analytics and Discovery Insights Specialist : Step 1

So there is a problem that I cannot see how to resolve.  I've worked out most of the elements that I need to do the Churn Rate calculation but there is an error.  Here is the code
 
-- Get the current and previous Qtr Subscriptions
q = load "Beattie_Subs";
Subs = group q by (Subscription_Date_Year, Subscription_Date_Quarter);
Subs = foreach Subs generate Subscription_Date_Year, Subscription_Date_Quarter, count() as CurrQtrSubs, sum(count()) over([-1 .. -1] partition by all order by Subscription_Date_Year) as PrevQtrSubs;

-- Fill the Subs gaps
Subs = fill Subs by (dateCols=(Subscription_Date_Year, Subscription_Date_Quarter, "Y-Q"));

-- Get the current and previous Qtr Cancellations
q = load "Beattie_Subs";
Canc = group q by (Churn_Date_Year, Churn_Date_Quarter);
Canc = foreach Canc generate Churn_Date_Year, Churn_Date_Quarter, count() as CurrQtrCanc, sum(count()) over([-1 .. -1] partition by all order by Churn_Date_Year) as PrevQtrCanc;

-- Fill the Canc gaps
Canc = fill Canc by (dateCols=(Churn_Date_Year, Churn_Date_Quarter, "Y-Q"));

-- Combine them
result = cogroup Subs by ('Subscription_Date_Year', 'Subscription_Date_Quarter') full, Canc by ('Churn_Date_Year', 'Churn_Date_Quarter');

-- Calc churn (to be completed)
result = foreach result generate Subs['Subscription_Date_Year'] as XX, Subs['Subscription_Date_Quarter'] as YY, 
coalesce(sum(Subs[CurrQtrSubs]),0) as 'CurrQtrSubs', 
coalesce(sum(Subs[PrevQtrSubs]),0) as 'PrevQtrSubs', 
coalesce(sum(Canc[CurrQtrCanc]),0) as 'CurrQtrCanc', 
coalesce(sum(Canc[PrevQtrCanc]),0) as 'PrevQtrCanc';
The reasons I can't complete is a problem with the Fill command.  When this is run you get a table that looks like this.  The Previous Quarter is being brought down to the Current Quarter fine.  But where an extra Quarter has been brought in by the Fill it is being skipped.

Step 1

SAQL is not well documented and there are few examples.  How should I structure the logic to work?
AnudeepAnudeep (Salesforce Developers) 
Hi Robin, 

Can you report this error to the Trailhead Support team as well for help? You can submit this as Case Submission: Problems Completing a Badge

https://trailhead.salesforce.com/help?support=home#cfPanel