KNOWLEDGE BASE

How To Show Sales of Today, This Month, Last Month in One Table


Published: 23 Oct 2020
Last Modified Date: 23 Oct 2020

Question

How to show last month's sales, this month sales, today sales in one table.

Environment

  • Tableau Desktop

Answer

1. Create a Calculation field of Today's sales
IF [Order Date]=TODAY() THEN [Sales] END

2. Create a Calculation field of This month's sales
IF DATETRUNC('month',[Order Date])=DATETRUNC('month',TODAY())
AND DAY([Order Date])<=DAY(TODAY())
THEN [Sales] END


3. Create a Calculation field of Last month's sales
IF DATETRUNC('month',[Order Date])=DATETRUNC('month',DATEADD('month',-1,TODAY()))
THEN [Sales] END
Did this article resolve the issue?