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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Vikas_Jayara12
New Member

Query on PreviousWeek Function

Hi Team,

I have used PREVIOUSDAY, PREVIOUSMONTH, PREVIOUSQUARTER & PREVIOUSYEAR function as well. However, unable to find PREVIOUSWEEK function. Just wanted to know why we don't have Previousweek function in DAX. Any specific reason?

 

Regards,

Vikas Singh Jayara

1 ACCEPTED SOLUTION
RicoZhou2
Resolver I
Resolver I

Hi @Vikas_Jayara12 ,

 

As far as I know, there isn't a DAX formula to calculate data in previous week. I suggest you to add a [Start Date] which is mentioned by the blog shared by ribisht17 to determind the week.

DimDate Table:

DimDate = 
VAR _BASIC = ADDCOLUMNS( CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"WeekNum",WEEKNUM([Date],2))
VAR _ADD = ADDCOLUMNS(_BASIC,"Start Date",[Date] - WEEKDAY([Date],2)+1)
Return
_ADD

Then create a measure based on DATEADD() function.

Last Week Sales = 
CALCULATE(SUM('Table'[Sales]),DATEADD(DimDate[Date],-7,DAY))

 

Best Regards.

View solution in original post

2 REPLIES 2
RicoZhou2
Resolver I
Resolver I

Hi @Vikas_Jayara12 ,

 

As far as I know, there isn't a DAX formula to calculate data in previous week. I suggest you to add a [Start Date] which is mentioned by the blog shared by ribisht17 to determind the week.

DimDate Table:

DimDate = 
VAR _BASIC = ADDCOLUMNS( CALENDARAUTO(),"Year",YEAR([Date]),"Month",MONTH([Date]),"WeekNum",WEEKNUM([Date],2))
VAR _ADD = ADDCOLUMNS(_BASIC,"Start Date",[Date] - WEEKDAY([Date],2)+1)
Return
_ADD

Then create a measure based on DATEADD() function.

Last Week Sales = 
CALCULATE(SUM('Table'[Sales]),DATEADD(DimDate[Date],-7,DAY))

 

Best Regards.

ribisht17
Super User
Super User

@Vikas_Jayara12 

 

Please find this blog / solution Solved: Calculate previousweek performance starting monday - Microsoft Power BI Community

 

Thanks,

Ritesh

Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.