How to display sales of last 90 days, last 30 days and last 60 days based on order date filter

In a report i want to display 4 columns (id, last 30 days sales, last 60 days sales, last 90 days sales) along with this a date filter (order_date) .

When a user selects order_Date as 2024-11-10, so according to this date data should be displayed and again if a user select 2024-11-15 , according to this data data should be displayed…

I have a columns in the table id, order_Date, sales

Can you please help me to write the logics or formulas

Hi @manideep1

you could try to use ifelse, datediff and sum to calculate it.

e.g “last 30 days sales”

  1. get only relevant sales:
    temp_sales30 = ifelse(datediff($date_parameter,order_date,"DD")<=30 and datediff($date_parameter,order_date,"DD")>=0 ,sales,0)
    dateDiff - Amazon QuickSight
  2. last 30 days sales = sum(temp_sales30)

BR

it’s not working , how can i use the date_parameter .

can you please explain in detail

You need to store the date selecting in a parameter to use it in the calculation: