Salesforce Certified Tableau Data Analyst Practice Questions

Salesforce Certified Tableau Data Analyst exam preparation

Salesforce Certified Tableau Data Analyst practice questions in English: 172 questions with explanations. The mock exam has 60 questions and 105 minutes.

Salesforce Certified Tableau Data Analyst free question 3 / 10 · Domain 2: Explore and Analyze Data

September 22, 2013 is a Sunday and September 28, 2013 is a Saturday. You write DATEDIFF('week', #2013-09-22#, #2013-09-28#, 'monday') and a second expression that is identical except that the last argument is 'sunday'. What do the two expressions return?

  1. 'monday' returns 0 and 'sunday' returns 1
  2. 'monday' returns 1 and 'sunday' returns 0
  3. Both return 1, because the start of week does not affect the result
  4. Both return 0, because the two dates are less than seven days apart
Show the answer and explanation

Answer: B

Why this is correct
DATEDIFF('week', ...) counts the week boundaries between the two dates, and the optional start_of_week argument decides which day is treated as the first day of the week. With 'monday', Sunday the 22nd belongs to the week that began on Monday the 16th, and Saturday the 28th belongs to the week that began on Monday the 23rd, so one boundary is crossed and the result is 1. With 'sunday', the 22nd through the 28th fall in the same week, so the result is 0. The help page shows the same pattern with September 22 and 24: 'monday' gives 1 because the dates are in different weeks, and 'sunday' gives 0 because they are in the same week.

Why the other options are wrong
"'monday' returns 0 and 'sunday' returns 1" … This has the direction reversed. With Monday as the start of week, the Sunday becomes the last day of the previous week and the Saturday falls in the next week, so one boundary is crossed.
"Both return 0, because the two dates are less than seven days apart" … DATEDIFF does not divide elapsed days by seven. It counts date_part boundaries between the dates, so a gap of six days can still return 1 if a week start falls in between.
"Both return 1, because the start of week does not affect the result" … start_of_week decides where the week boundaries are, so it changes the result for 'week'. With 'sunday' the two dates sit inside one week, no boundary is crossed, and the result is 0.

Key point
When start_of_week is omitted, the first day of the week is determined by the data source's date properties, so results can vary. Writing start_of_week in the expression removes the doubt for the reader. ISO weeks always start on Monday.

Go to the Salesforce Certified Tableau Data Analyst practice app (10 free questions; purchase unlocks all questions)

See the full practice set