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
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
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.