Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ccaramid
New Member

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?

1 ACCEPTED SOLUTION
Kedar_Pande
Community Champion
Community Champion

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

View solution in original post

1 REPLY 1
Kedar_Pande
Community Champion
Community Champion

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.