Previous Period Comparison

Hi,

I’m new to QuickSight and having a problem retrieving comparative data for the same month last year.

I’m using 2 calculated fields:

  • Same Month LY Date = addDateTime(-1, ‘YYYY’, {This Month Start Date})
  • Same Month LY Value = periodOverPeriodLastValue(sum({Sales}), {Same Month LY Date}, YEAR, 1)

… but no value is returned.

What am I missing?

Any help will be greatly appreciated.

You don’t need to add the same month LY Date.

You should be able to do just this.

periodOverPeriodLastValue(sum({Sales}), {This Month Start Date}, YEAR, 1)

Hi Max,

Thanks for your response.

I made the change you suggested but, unfortunately, got the same result.

Hi terryb,

To improve the communication, and the chance of obtaining an answer which is usable for you, I would suggest that you elaborate a little more on your use case. To be precise,

  • What does your dataset look like?
  • What fields does your dataset have, and what type do these fields have?
  • Provide a minimalistic example of some data that you might have in that dataset.
  • I.e. not too many rows, but still enough rows to capture the essence of your case.
  • And finally, for that very concrete dateset, explain what kind of output you are looking for? Do this by providing your own manually computed and formatted results. It will enable the community to support you better.

Cheers,
Kåre

Hi Max & Kaare,

Problem solved!

After receiving Kaare’s response, I re-checked my dataset and found and corrected the problem. The periodOverPeriodLastValue function now works as per Max’s response.

Thank you both for your assistance. Much appreciated.

2 Likes