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
rajanimaddala
Helper II
Helper II

Sameperiodlastyear

Hi mates
I have dataset of sales for 2 years. FY starts from Aug to Jul.
I have a slicer for FY.
I am trying to get Sales from YTD(Aug to Dec current FY) but data set has future dates which is fine. And also need to get last year sales for the sameperiod(2018 Aug to Dec current date).
I have created measure to get current YTD revenue as
Sales YTD = SUMX(Filter(table, salesdate <= today()), salesvalue)

How do I get last year sales value(DAX expression)?

Regards
2 REPLIES 2
Tahreem24
Super User
Super User

Hi @rajanimaddala ,

 

In order to calculate last year sales you can use any measure out of below 4 mentioned:

1. Last Year Sales  = CALCULATE(SUM([Total Sales]),DATEADD([Date]),-1,YEAR))

2. Last Year Sales  = CALCULATE(SUM([Total Sales]),PREVIOUSYEAR([Date]))

3. Last Year Sales  = CALCULATE(SUM([Total Sales]),PARALLELPERIOD([Date],-1,YEAR))

4. Last Year Sales = CALCULATE([Total Sales], SAMEPERIODLASTYEAR(‘Calendar’ [Date]))

 

Please give Thumps up for Support and accept this as a solution if it helps you!

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
v-joesh-msft
Solution Sage
Solution Sage

Hi @rajanimaddala ,

Your YTD looks a little weird. Do you want a measure similar to the following:

 

Sales YTD =
VAR _lastdate =
    DATE ( YEAR ( NOW () ) - 1, MONTH ( NOW () ), DAY ( NOW () - 1 ) )
RETURN
    SUMX ( FILTER ( table, salesdate <= _lastdate ), salesvalue )

 

If it doesn't meet your requirement, kindly share your sample data and expected result if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

Best Regards,

Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.