Forum Discussion
Filtering relative date - two conditions
Hi,
I would like to filter by relative date, but I need two conditions:
-is in the last 3 months
OR
- is in the next 9 months
The result must show a 12 month period (one quarter in the past, and 3 in the future.
From what I can see, the filter by relative date only allows choosing one. If I create 2 filters, it's an AND not an OR and it removes all results... Is there a way to do this please?
create a calculated column:
DateRangeFlag =
VAR CurrentDate = TODAY()
VAR PastStartDate = EDATE(CurrentDate, -3) // 3 months ago
VAR FutureEndDate = EDATE(CurrentDate, 9) // 9 months into the future
RETURN
IF(
'YourTable'[Date] >= PastStartDate && 'YourTable'[Date] <= CurrentDate ||
'YourTable'[Date] > CurrentDate && 'YourTable'[Date] <= FutureEndDate,
1,
0
)Set the filter to show only where DateRangeFlag is equal to 1
π If this helped, a Kudos π or Solution mark would be great! π
Cheers,
Kedar
Connect on LinkedIn
1 Reply
- Kedar_PandeSuper User
create a calculated column:
DateRangeFlag =
VAR CurrentDate = TODAY()
VAR PastStartDate = EDATE(CurrentDate, -3) // 3 months ago
VAR FutureEndDate = EDATE(CurrentDate, 9) // 9 months into the future
RETURN
IF(
'YourTable'[Date] >= PastStartDate && 'YourTable'[Date] <= CurrentDate ||
'YourTable'[Date] > CurrentDate && 'YourTable'[Date] <= FutureEndDate,
1,
0
)Set the filter to show only where DateRangeFlag is equal to 1
π If this helped, a Kudos π or Solution mark would be great! π
Cheers,
Kedar
Connect on LinkedIn