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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Praj
Helper I
Helper I

Get last 6 weeks and next 6 weeks data from current date

Hello Everyone,

 

I have a huge dataset in a table "Raw" and I am looking create a new table which gives me the data from last 6 weeks and next 6 weeks from current day.

I did write the below code but I am just getting partial rows and not the entire output I am expecting. Can anyone suggest the most efficient approach for this problem.

 

Last 6 Weeks and Next 6 Weeks = 
VAR CurrentDate = TODAY()
VAR MinDate = MIN(Raw_Salesforce[Close_Date])
VAR MaxDate = MAX(Raw_Salesforce[Close_Date])
RETURN
    FILTER(
        'Raw_Salesforce',
        Raw_Salesforce[Close_Date] >= DATEADD(Raw_Salesforce[Close_Date], -42, DAY) &&
        Raw_Salesforce[Close_Date] <= DATEADD(Raw_Salesforce[Close_Date], 42, DAY) && 
        Raw_Salesforce[Close_Date]  >= IF(CurrentDate > MaxDate, MaxDate, CurrentDate) - 42 &&
        Raw_Salesforce[Close_Date]  <= IF(CurrentDate < MinDate, MinDate, CurrentDate) + 42 

    )



Thanks in advance!

Cheers,

Praj

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Praj 

try like:

Last 6 Weeks and Next 6 Weeks =
    FILTER(
        Raw_Salesforce,
        Raw_Salesforce[Close_Date]>=TODAY()-42
            &&Raw_Salesforce[Close_Date]<=TODAY()+42
    )

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @Praj 

try like:

Last 6 Weeks and Next 6 Weeks =
    FILTER(
        Raw_Salesforce,
        Raw_Salesforce[Close_Date]>=TODAY()-42
            &&Raw_Salesforce[Close_Date]<=TODAY()+42
    )

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.