+ Start a Discussion
Brian KesslerBrian Kessler 

Einstein Analytics and Discovery Insights Specialist Challenge 3: How do I calculate subscriber attrition cost?

I am presently stuck on Einstein Analytics and Discovery Insights Specialist Superbadge (https://trailhead.salesforce.com/en/content/learn/superbadges/superbadge_analytics_insights_specialist) Challenge #3

The dashboard designer tells me there is an error in my Attrition Cost step
 
Warning! 
Analytics encountered a problem with this step [Attrition_Cost_1]. 
Input stream not found

My SAQL query is this:
beattieSubscribers = load "Beattie_Subs"; tenuredSubscribers = filter beattieSubscribers by{{row(Tenure_Length_1.selection,[0],["min","max"]).asRange ("Tenure")}}; churnedSubscribers = filter tenuredSubscribers by 'Churn' == "Yes"; attrCost = churnedSubscribers * 950.00;


What am I missing?
 
Best Answer chosen by Brian Kessler
Brian KesslerBrian Kessler
After much struggle and no help, I finally figured it out:

1. After filtering the beattieSubscribers for Tenure and Churn, I need to group these.
 
groupedSubscribers = group tenuredSubscribers by all full, churnedSubscribers by all;

and then,

2. I needed to generate the attrition cost for each subscriber in the group, and assign the value using "as" syntax, instead of just equals:
 
attrCost = foreach groupedSubscribers generate count(churnedSubscribers)*950 as 'attrCost';





 

All Answers

Brian KesslerBrian Kessler
I am still stuck here... some more info if it helps anyone to help me:

I have the above SAQL query as the query in the "Attrition_Cost__1" step, which at length looks like this:
 
"Attrition_Cost_1": {
                "broadcastFacet": true,
                "groups": [],
                "label": "Attrition Cost",
                "numbers": [],
                "query": "beattieSubscribers = load \"Beattie_Subs\";\r\ntenuredSubscribers = filter beattieSubscribers by{{row(Tenure_Length_1.selection,[0],[\"min\",\"max\"]).asRange (\"Tenure\")}};\r\nchurnedSubscribers = filter tenuredSubscribers by 'Churn' == \"Yes\";attrCost = churnedSubscribers * 950.00;\r\n",
                "receiveFacet": true,
                "selectMode": "single",
                "strings": [],
                "type": "saql",
                "useGlobal": true
            },

However in the Dashboard Designer, on the right, under "Steps with Errors" I see:
 
Attrition Cost
Attrition_Cost_1

If I click "View Error", I see:
 
Warning!
Analytics encountered a problem with this step [Attrition_Cost_1].
Input stream not found

FWIW, if I check the challenge -- which I wouldn't actually expect to pass right now -- I get the following error:
 
Challenge Not yet complete... here's what's wrong: 
We can't confirm the chart reference lines have the correct label and value. The reference line has to have attrition costs as its label and value, plus filter by the Tenure Length toggle.

Can anyone kindly explain what this error means and an appropriate fix?
 
Brian KesslerBrian Kessler
After much struggle and no help, I finally figured it out:

1. After filtering the beattieSubscribers for Tenure and Churn, I need to group these.
 
groupedSubscribers = group tenuredSubscribers by all full, churnedSubscribers by all;

and then,

2. I needed to generate the attrition cost for each subscriber in the group, and assign the value using "as" syntax, instead of just equals:
 
attrCost = foreach groupedSubscribers generate count(churnedSubscribers)*950 as 'attrCost';





 
This was selected as the best answer