Can I compare data by week?

I am creating a billing data analysis dashboard and I want to compare data in some ways.

  1. When I specify a date, I want to compare the increase in billing data from last week to next week.

Example: When selecting the date of the 2nd week of May, the total billing data of the 1st, 2nd, and 3rd weeks are compared respectively.

  1. If I specify a start date and an end date, can I compare data from the same section before that?

Example: When specifying the start date as May 14 and the end date as May 20, it is for 14 days, so I want to see the sum of the data for 14 days from May 1 to May 13.

hi @joohyery,

thank you for your inquiry in QuickSight Community!

as for 1, you can create calculated filed using truncDate() with ‘week’ specified as well as addDateTime() for next and last week to identify. then to aggregate and filter with the field.

truncDate(“WK”, {Billing Date}) = truncDate(“WK”,${day}), “thisweek”,
truncDate(“WK”, {Billing Date}) = addDateTime(-1,“WK”,truncDate(“WK”,${day})), “last week”,
truncDate(“WK”, {Billing Date}) = addDateTime(1,“WK”,truncDate(“WK”,${day})), “next week”,

kind regards,

1 Like

as for 2, in similar way you can use datediff() to get duration days and using addDateTime(), you should be able to get the last period of date. the example is the below.

addDateTime(-(dateDiff(${startDay},${EndDay},“DD”)), ‘DD’,${startDay})
addDateTime(-(dateDiff(${startDay},${EndDay},“DD”)), ‘DD’,${EndDay})

kind regards,

1 Like