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
sri__psri__p 

Einstein Analytics and Discovery Insights Specialist - Step 1

Hi,

I tried several ways but keep getting below error on Challenge 1. Any help or guidance is greatly appreciated.

https://trailhead.salesforce.com/en/content/learn/superbadges/superbadge_analytics_insights_specialist

Challenge Not yet complete... here's what's wrong:
We can't confirm this is the correct quarter. Records should be grouped by subscriber activity (sign ups and cancellations). A suggestion is to generate a stream for subscriber records by Subscription Date and its counts, along with Churn Date and its counts. Ensure both streams for these date fields share a common variable then create a union of both streams.

 
q = load "Beattie_Subs";

subs = group q by ('Subscription_Date_Year', 'Subscription_Date_Quarter');
subs = foreach subs generate 'Subscription_Date_Year' + "-" + 'Subscription_Date_Quarter' as 'ActivityDate_Year-ActivityDate_Quarter', count() as 'Current Quarter Subscribers';

churns = group q by ('Churn_Date_Year', 'Churn_Date_Quarter');
churns = foreach churns generate 'Churn_Date_Year' + "-" + 'Churn_Date_Quarter' as 'ActivityDate_Year-ActivityDate_Quarter', count() as 'Current Quarter Churns';

result = group subs by 'ActivityDate_Year-ActivityDate_Quarter' full, churns by 'ActivityDate_Year-ActivityDate_Quarter';
result = foreach result generate coalesce(subs.'ActivityDate_Year-ActivityDate_Quarter', churns.'ActivityDate_Year-ActivityDate_Quarter') as 'ActivityDate_Year-ActivityDate_Quarter', sum(subs.'Current Quarter Subscribers') as 'Current Quarter Subscribers', sum(churns.'Current Quarter Churns') as 'Current Quarter Churns';
result = group result by ('ActivityDate_Year-ActivityDate_Quarter', 'Current Quarter Subscribers', 'Current Quarter Churns');
result = foreach result generate 'ActivityDate_Year-ActivityDate_Quarter', sum('Current Quarter Subscribers') as 'Current Quarter Subscribers', 'Current Quarter Churns', sum('Current Quarter Subscribers') over ([..-1] partition by all order by 'ActivityDate_Year-ActivityDate_Quarter') - coalesce(sum('Current Quarter Churns') over ([-1..-1] partition by all order by 'ActivityDate_Year-ActivityDate_Quarter'),0) as 'Previous Quarter Subscribers';
result = foreach result generate 'ActivityDate_Year-ActivityDate_Quarter', 'Current Quarter Churns'/(coalesce('Previous Quarter Subscribers',0) + coalesce('Current Quarter Subscribers',0)) as 'Churn Rate';

Thanks
Sri.​​​​​​​
Best Answer chosen by sri__p
SwethaSwetha (Salesforce Developers) 
HI Sri,
We have separate Trailhead team who can help you with these issues. So,can you please use the below link to reach out to them so that one of the Engineers will get in touch with you.
Support: https://trailhead.salesforce.com/en/help?support=home
 
Please mark this answer as best if it helps so that others facing same issue will find it useful.
 
Thanks