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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
VisheshVats
Helper I
Helper I

DAX help to create measure.

How can i get the sale for the day one week back,month back and year back for a particular column?

Not sum till date, just the sale on that particular day, week back,one month back and year back.

For eg, if today is 28/07/2022, i want my sale on 21/06/2022,28/06/2022 and 27/07/2021.

Thanks In Advance.

Data set view and expected results images attached.

Many Thanks.

 

Capture.PNGCapture1.PNG

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can use DATEADD, e.g.

Prev Month = CALCULATE( [Base measure], DATEADD('Date'[Date], -1, MONTH)

Prev Year = CALCULATE( [Base measure], DATEADD('Date'[Date], -1, YEAR)

Prev Week = CALCULATE( [Base measure], DATEADD('Date'[Date], -7, DAY )

View solution in original post

1 REPLY 1
johnt75
Super User
Super User

You can use DATEADD, e.g.

Prev Month = CALCULATE( [Base measure], DATEADD('Date'[Date], -1, MONTH)

Prev Year = CALCULATE( [Base measure], DATEADD('Date'[Date], -1, YEAR)

Prev Week = CALCULATE( [Base measure], DATEADD('Date'[Date], -7, DAY )

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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