I have a dashboard where I have data for each month for last 1 year.
Now I need to show data for last quarter (July-Sep)
Could anyone please help me what is the formula we need to write to get last quarter.
EDIT (based on question update):
sum(
if ( QUARTER([Date]) = QUARTER(DATEADD('quarter',-1,TODAY()))
and YEAR([Date]) = YEAR(DATEADD('quarter',-1,TODAY()))
) then [Value]
end
)
If you're using Tableau version older than 2019.3, you have to replace QUARTER with:
datepart('Quarter', [Date])