You need to sign in to do that
Don't have an account?
Einstein Analytics and Discovery Insights Specialist Challenge 2: What is wrong with my SAQL query?
I'm currently still struggling with Einstein Analytics and Discovery Insights Specialist (https://trailhead.salesforce.com/en/content/learn/superbadges/superbadge_analytics_insights_specialist?trailmix_creator_id=briankessler&trailmix_id=getting-started-with-analytics) Challenge 2:
My SAQL query is now:
However, this results in the following error displayed on the page:
.
What is wrong here and how can/should I fix this?
Thanks?
My SAQL query is now:
beattieSubscribers = load "Beattie_Subs"; tenuredSubscribers = filter beattieSubscribers by row( Tenure_Length.selection, [0], ["min","max"] ).asRange("Tenure"); churnSubscribers = filter tenuredSubscribers by 'Churn' == "Yes"; groupedSubscribers = group tenuredSubscribers by all full, churnSubscribers by all; churnRate = foreach groupedSubscribers generate (count(churnSubscribers) / count(tenuredSubscribers))*100 as 'churnRate';
However, this results in the following error displayed on the page:
Function doesn't have a type check definition:
.
What is wrong here and how can/should I fix this?
Thanks?
Here is the code I used :
Churn Tenure step :
Toggle widget :
All Answers
Here is the code I used :
Churn Tenure step :
Toggle widget :
There is no confirmation button on this page.
There is no undo button on this page.
I just clicked on the wrong place on the page and suddenly the above answer was accepted as "best answer", but it did NOT actually work.
If I entered the formula as-is into the SAQL editor, the editor just becomes unresposive.
I added some more \ marks before the quotes and put it into the json along with a property name "query", but nothing displays and if I try to save, I get:
The relevant part of my JSON now looks like this:
I was just being dense and mixing up the steps.
Emilien Guichard 40
Hi,
have tried with the query :
q = load "Beattie_Subs"; filter q by {{row(Tenure_Length_1.selection,[0],[\"min\",\"max\"]).asRange (\"Tenure\")}};q_B = filter q by 'Churn' == "Yes"; result = group q by all full, q_B by all; result = foreach result generate (count(q_B) / count(q))*100 as 'churnRate';
but it's not returning and also not showing an error , it look like it's loading but i waited for 30-40 mins it's not returning with results . Still showing it's loading.
Please help me on this.
q = load \"Beattie_Subs\";
q = filter q by 'Tenure' => 50;
q_B = filter q by 'Churn' == \"Yes\";
result = group q by all full, q_B by all;
result = foreach result generate (count(q_B) / count(q))*100 as 'churnRate';
- Edit in the JSON mode (ctrl+e) and add the bind {{row(Tenure_Lenght_1.selection,[0],[\"min\",\"max\"]).asRange(\"Tenure\")}}
q = load \"Beattie_Subs\";q = filter q by {{row(Tenure_Lenght_1.selection,[0],[\"min\",\"max\"]).asRange(\"Tenure\");
q_B = filter q by 'Churn' == \"Yes\";
result = group q by all full, q_B by all;
result = foreach result generate (count(q_B) / count(q))*100 as 'churnRate'
- Move the Tenure Length step above this step
"Tenure_Lenght_1": {"broadcastFacet": true,
"columns": {
"min": {
"type": "string"
},
"max": {
"type": "string"
},
"value": {
"type": "string"
},
"Display": {
"type": "string"
}
},
"label": "Tenure Lenght",
"selectMode": "single",
"type": "staticflex",
"values": [
{
"Display": "High Risk",
"min": 1,
"max": 12,
"value": "1 to 12 months"
},
{
"Display": "Medium Risk",
"min": 13,
"max": 24,
"value": "13 to 24 months"
},
{
"Display": "Low Risk",
"min": 25,
"max": 36,
"value": "25 to 36 months"
}
]
},
"Churn_Tenure_1": {
"broadcastFacet": true,
"groups": [],
"label": "Churn Tenure",
"numbers": [],
"query": "q = load \"Beattie_Subs\";\nq = filter q by {{row(Tenure_Lenght_1.selection,[0],[\"min\",\"max\"]).asRange(\"Tenure\")}};\nq_B = filter q by 'Churn' == \"Yes\";\nresult = group q by all full, q_B by all;\nresult = group q by all full, q_B by all;\nresult = foreach result generate (count(q_B) / count(q))*100 as 'churnRate';",
"receiveFacetSource": {
"mode": "all",
"steps": []
},
"selectMode": "single",
"strings": [],
"type": "saql",
"useGlobal": true,
"visualizationParameters": {
"parameters": {
"autoFitMode": "keepLabels",
"max": 100,
"legend": {
"showHeader": true,
"show": false,
"position": "right-top",
"inside": false
},
"icon": "circle",
"iconRounding": "none",
"visualizationType": "rating",
"title": {
"fontSize": 14,
"subtitleFontSize": 11,
"label": "",
"align": "center",
"subtitleLabel": ""
},
"trellis": {
"flipLabels": false,
"showGridLines": true,
"size": [
100,
100
],
"enable": false,
"type": "x",
"chartsPerLine": 4
},
"colors": {
"lowColor1": "#1674D9",
"highColor1": "#1674D9"
},
"high": 50,
"showActionMenu": true,
"min": 0,
"numberOfIcons": 10,
"valueType": "compactNumber",
"valuesOnLeft": false,
"theme": "wave",
"applyConditionalFormatting": true,
"showMax": false
},
"type": "chart"
}
},
"Churn_Rate_1": {
I have Stucked in challange 2
I have created the tresure length like this
and my Query/json is like below:
"Tenure_Lenght_1": {
"broadcastFacet": true,
"columns": {
"min": {
"type": "string"
},
"max": {
"type": "string"
},
"value": {
"type": "string"
},
"Display": {
"type": "string"
}
},
"label": "Tenure Lenght",
"selectMode": "single",
"type": "staticflex",
"values": [
{
"Display": "High Risk",
"min": 1,
"max": 12,
"value": "1 to 12 months"
},
{
"Display": "Medium Risk",
"min": 13,
"max": 24,
"value": "13 to 24 months"
},
{
"Display": "Low Risk",
"min": 25,
"max": 36,
"value": "25 to 36 months"
}
]
},
have tried with the query :
q = load "Beattie_Subs"; filter q by {{row(Tenure_Length_1.selection,[0],[\"min\",\"max\"]).asRange (\"Tenure\")}};q_B = filter q by 'Churn' == "Yes"; result = group q by all full, q_B by all; result = foreach result generate (count(q_B) / count(q))*100 as 'churnRate';
but it's not returning and also not showing an error , it look like it's loading but i waited for 30-40 mins it's not returning with results . Still showing it's loading.
Please help me here! Thanks in advance!
2) Add a toggle in the dashboard and in properties:
drag the tenure length over the toggle
3) Add a chart and in the advanced editor,
Select query as Toggle query and then choose min max
and then choose selection :
edit fieldname as Tenure and copy paste in the query :
"query": "q = load \"Beattie_Subs\";\nq = filter q by {{row(Tenure_Length_1.selection, [0], [\"min\", \"max\"]).asRange(\"Tenure\")}};\nq_B = filter q by 'Churn' == \"Yes\";\nresult = group q by all full, q_B by all;\nresult = foreach result generate (count(q_B) / count(q))*100 as 'churnRate';",