cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter period for the last3 months

0 Kudos

Hi experts,

I have a table as per below and would like to filter the dates to only to show the last 3 months per Product. I am struggling with the proper formula and have used Rank() function but it shows 1 for all dates, which is not what I expect.

Would you be able to help advise?

Original table:



Expected result:

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member805600
Discoverer
0 Kudos

I think this gets the results you are looking for:

Create 4 user variables:

  1. Max Period =Max([Period]) In([Product])
  2. Max Period - 1 = RelativeDate([Max Period];-1;MonthPeriod)
  3. Max Period - 2 = RelativeDate([Max Period];-2;MonthPeriod)
  4. Filter = If [Period] = [UV Max Period] Or [Period] = [Max Period - 1] Or [Period] = [Max Period - 2] Then 1 Else 0

Then filter your table where Filter = 1