I want the sum of sales to populate with Date Level Selector:
The results populate right but are not in order. I am not able to do a sort by Month when month selected or even fiscal doesn't populate in order.
Below is the formula used:
CASE [Date Level Selector]
WHEN 'Year' THEN STR(YEAR([Date]))
WHEN 'Fiscal Year' THEN
IF MONTH([Date]) >= 9 THEN
"FY " + STR(YEAR([Date]) + 1)
ELSE
"FY " + STR(YEAR([Date]))
END
WHEN 'Month' THEN
DATENAME('month',[Date]) + " " + STR(YEAR([Date]))
WHEN 'Day' THEN
// Format Date as MM/DD/YY
RIGHT("00" + STR(MONTH([Date])), 2) + "/" +
RIGHT("00" + STR(DAY([Date])), 2) + "/" +
RIGHT(STR(YEAR([Date])), 2)
WHEN 'Week' THEN
RIGHT("00" + STR(MONTH(DATETRUNC('week', [Date]))), 2) + "/" +
RIGHT("00" + STR(DAY(DATETRUNC('week', [Date]))), 2) + "/" +
RIGHT(STR(YEAR(DATETRUNC('week', [Date]))), 2)
END
It is difficult to work from just the description in the post - please post a representative workbook (even fake data) so we can see what you have done - if you are working with sensitive data we recommend https://community.tableau.com/s/anonymize-tableau-package-data -
Before you reply make sure the data has been extracted from any live D/B and the file is in a TWBX format