The client is trying to create a SAQL query to predict sales in each sales region. They cannot get the query to return any results, but have identified that the enror is in the timeseries statement. They have asked a Tableau CRM Consultant to review the following query and fix any errors. q = load “sales”; q = group q by (‘Date_Year’, ‘Date_Month’, ‘Region’); q = foreach q generate ‘Date_Year’, ‘Date_Month’, ‘Region’, sum(‘Sales’) as ‘sum_Sales’; q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (dateCols=(‘Date_Year’, ‘Date_Month’, “Y-M”), partition=’Region’); q = foreach q generate ‘Date_Year’ + “~~~” + ‘Date_Month’ as ‘Date_Year~~~Date_Month’, ‘Region’, coalesce(‘sum_Sales’, ‘Forecasted_Sales’) as ‘Sales’; q = order q by (‘Date_Year~~~Date_Month’ asc, ‘type’ asc); q = limit q 2000; Which timeseries statement will fix the query?
Below is the answer and explanation for the question in the Salesforce Exams.
The client is trying to create a SAQL query to predict sales in each sales region. They cannot get the query to return any results, but have identified that the enror is in the timeseries statement. They have asked a Tableau CRM Consultant to review the following query and fix any errors. q = load “sales”; q = group q by (‘Date_Year’, ‘Date_Month’, ‘Region’); q = foreach q generate ‘Date_Year’, ‘Date_Month’, ‘Region’, sum(‘Sales’) as ‘sum_Sales’; q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (dateCols=(‘Date_Year’, ‘Date_Month’, “Y-M”), partition=’Region’); q = foreach q generate ‘Date_Year’ + “~~~” + ‘Date_Month’ as ‘Date_Year~~~Date_Month’, ‘Region’, coalesce(‘sum_Sales’, ‘Forecasted_Sales’) as ‘Sales’; q = order q by (‘Date_Year~~~Date_Month’ asc, ‘type’ asc); q = limit q 2000;
Which timeseries statement will fix the query?
- q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (dateCols=(‘Date_Year’, ‘Date_Quarter’, “Y-Q”), partition=’Region’, ignoreLast=true);
- q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (length=12, dateCols=(‘Date_Year’, ‘Date_Month’, “Y-M”), partition =’Region’);
- q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (dateCols=(‘Date_Year’, ‘Date_Quarter’, “Y-Q”), partition =”Region’); ✅
- q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (dateCols=(‘Date_Year’, ‘Date_Quarter’, “Y-Q”), partition =’Region’, seasonality=4);
Correct Answers
q = timeseries q generate ‘sum_Sales’ as ‘Forecasted_Sales’ with (dateCols=(‘Date_Year’, ‘Date_Quarter’, “Y-Q”), partition =”Region’); ✅
Explanation
Timeseries crunches your data and selects the forecasting model that gives the best fit. You can let timeseries select the best model or specify the model you want. timeseries detects seasonality in your data. It considers periodic cycles when predicting what your data will look like in the future. You can specify the type of seasonality or let timeseries choose the best fit.
The amount of data, which is required to make a prediction depends on how your data is filtered and grouped. For example, for a non-seasonal monthly model, 2 data points are sufficient, whereas for a seasonal monthly model, at least 24 data points (two seasonal cycles) are required. If you don’t have enough data to make a good prediction, timeseries returns nulls in the data. If no data is passed to timeseries, an empty dataset is returned.
The above question is related to the Salesforce Exams. You can find all the updated questions and answers related to the Salesforce Admin Practice Exam on the “Salesforce Exams” page. If you find the update in questions or answers, do comment on this page to let us know. I will update the answers as soon as possible.
To learn about Salesforce Exams: Salesforce Exams.
Was this article helpful?
Support us to keep up the good work and to provide you even better content. Your donations will be used to help students get access to quality content for free and pay our contributors’ salaries, who work hard to create this website content! Thank you for all your support!
Reaction to comment: Cancel reply