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
Anonymous
Not applicable

Sales Last year and Current Year

I need to calculate sales this year vs same period last year, but my problem is the way data is recorded. For 2021, sales are updated only once a month for previous month and all sales during that month have sales date as the first day of that month. For example, last month data is from February with all sales dates in that month being 2/1/2021. Same situation with sales recorded in 2020, basically we have 12 dates for entire year worth of sales (1/1/2020, 2/1/2020, 3/1/2020, and so on).

 

I tried using usual TOTALYTD and SAMEPERIODLASTYEAR but they keep giving me entire year worth of data for 2020 and up to date in 2021 since no other sales data is available past 02/2021 yet.

 

Any idea how I could solve this problem? One thing worth of mentioning is that I do not have date slicers since report is supposed to always show up to date information with same period last year for comparison.

1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@Anonymous 

 

Try the following formulas:

YTD = CALCULATE(SUM(Table[Amount]),DATESYTD('Calendar'[Date]))

YTD LY = CALCULATE([YTD],SAMEPERIODLASTYEAR('Calendar'[Date]))

 

YTD LY = CALCULATE ( [YTD], PREVIOUSYEAR ( Calendar[Date] ) )

View solution in original post

2 REPLIES 2
themistoklis
Community Champion
Community Champion

@Anonymous 

 

Try the following formulas:

YTD = CALCULATE(SUM(Table[Amount]),DATESYTD('Calendar'[Date]))

YTD LY = CALCULATE([YTD],SAMEPERIODLASTYEAR('Calendar'[Date]))

 

YTD LY = CALCULATE ( [YTD], PREVIOUSYEAR ( Calendar[Date] ) )

Anonymous
Not applicable

I tried these formulas but for some reason I get entire year worth of data, not January and February 2020 vs 2021 but entire 2020 vs whatever I have in 2021.

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.