How to calculate same day last year in quicksight

Hi @kirthikka8, here is a high-level on how to calculate “same week last year”:

  1. Create a Calculated Field for Last Year’s Date:
  • Use dateAdd('YYYY', -1, {your_date_field}) to subtract one year from the current date.
  1. Extract Week Numbers:
  • Extract the week number for the current date: extract('WK', {your_date_field}).
  • Extract the week number for last year’s date: extract('WK', {DateLastYear}).
  1. Create a Custom Filter Condition:
  • Compare the current week number with the week number from the same week last year using a custom filter:
ifelse(
  extract('WK', {your_date_field}) = extract('WK', dateAdd('YYYY', -1, {your_date_field})),
  'Same Week Last Year',
  'Other'
)
  1. Apply the Filter to Your Visuals:
  • Add a visual to your analysis and apply the custom filter condition to focus on the same week last year.

Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!