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:

Hi @manideep1

It’s been a while since we last heard from you. If you have any further questions, please let us know how we can assist you.

If we don’t hear back within the next 3 business days, we’ll proceed with close/archive this topic.

Thank you!

Hi @manideep1

Since we have not heard back from you, I’ll go ahead and close this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for relevant information.

Thank you!