Forum Discussion
stuart765
3 years agoFrequent Visitor
SAMEPERIODLASTYEAR Problem
I am attempting to create a dashboard (cards) showing current year revenue (SP Revenue CY) vs. previous year revenue (SP Revenue Previous Year) and have the DAX commands listed below for each.
1. SP Revenue CY = SUM('SP Sold Rxs 1_1_2020 through Present 12_26_2022'[Revenue Validated])
2. SP Revenue Previous Year = CALCULATE('SP Sold Rxs 1_1_2020 through Present 12_26_2022'[SP Revenue CY],SAMEPERIODLASTYEAR('SP Sold Rxs 1_1_2020 through Present 12_26_2022'[Month-Year].[Date]))
I added a calendar table and joined it with the main data table. A dropdown was created for Year, Month, Day so I could compare different timeframes (e.g., first 14 days of month vs previous year's month first 14 days). I only see data for the entire month whether I choose Day1, Days 1-15 and/or Days 21-30.
Any suggestions on how to
hi stuart765
try like:
SP Revenue Previous Year =CALCULATE(SPTable [SP Revenue CY],DATEADD(CalendarTable[Date], -1, MONTH))Please let me know if it works, then we say why SAMEPERIODLASTYEAR is not working.
2 Replies
- stuart765Frequent Visitor
I used the formula referenced and Previous Year Revenue did not return a value. It was blank.