Hi @kirthikka8, here is a high-level on how to calculate “same week last year”:
- Create a Calculated Field for Last Year’s Date:
- Use
dateAdd('YYYY', -1, {your_date_field})
to subtract one year from the current date.
- 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})
.
- 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'
)
- 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!