Conditionally Show the Products Sales Larger Or Smaller than Previous Day

Published: 23 Oct 2020
Last Modified Date: 08 Jul 2022


How to show only the products whose sales are larger (or smaller) from the previous day's sales. 
For example, if you open a workbook which the latest date of data source is October 14th, the products which sales are larger than the sales of October 13th are shown in the view.



  • Tableau Desktop


  1. Create a calculation field for the latest day's sale: [! Today sale]
    • [Sales]
  2. Create a calculation field of the previous day's sale: [! Yesterday sales]
    • LOOKUP(SUM([Sales]),-1)
  3. Create a calculation field to filter the latest date in the data source: [! Today Filter]
    • LOOKUP(MAX([Order Date]),0)
  4. Create a calculation field to show the value which is larger than yesterday's sales. [! Sales Filter]
    • SUM([! Today sale]) - [! Yesterday sales] >= 0
  5. Add [Order Date] to [Details], set as [Exact Date].
  6. Add [Product ID] into [Rows].
  7. Add [! Today Filter] and [! Sales Filter] into [Filter], and set [Compute using] as [Order Date]
Did this article resolve the issue?