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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
saurabhtd
Resolver II
Resolver II

Previous year Last week dax logic / How to get Last week sales for previous year  ?

How to get Last week sales for previous year ? 

@amitchandak @Sahir_Maharaj @Greg_Deckler @FreemanZ @Ashish_Mathur @olgad @tamerj1 @andhiii079845 

 

4 REPLIES 4
andhiii079845
Super User
Super User

Again, please a full example. This is completely unclear what your problem is.

https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-Get-Your-Question-Answered-Quickly/m-p...





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




andhiii079845
Super User
Super User

Please a example with some underlaying data and what do you want. Please read the pinned post how to ask for help. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DAXDigger
Regular Visitor

@saurabhtd This works well if you have disconnected date dimension table

Measure = 
VAR _selectedDate = Today() //SELECTEDVALUE(dimDate[Date])
VAR _startDate = (_selectedDate-(WEEKDAY(_selectedDate,2)-1))-7
VAR _pystartDate = DATE(YEAR(_startDate)-1,MONTH(_startDate),DAY(_startDate))
VAR _endDate = _startDate+6
VAR _pyendDate = DATE(YEAR(_endDate)-1,MONTH(_endDate),DAY(_endDate))
RETURN  CALCULATE(SUM(Table[Sales]),Table[Date] >= _pystartDate && Table[Date] <= _pyendDate)

 

I have connected calendar table. So this doesn't work.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors