Forum Discussion
Comparison To same period last Year
Hello i am comparing some volumes to the same period last year by month. This works fine. but for current month last year i would like it to only inlcude up to current date this month. At the moment it shows total so far this month but it comapres it to the total of febuary 2021.
Here is the dax i curently use for previous year
Mail Received PY =
CALCULATE(
SUM('FACT - Mail Receipts'[Volume]),
SAMEPERIODLASTYEAR('DIM - Date Table'[Date])
)
NewbieJono , Try if this can help
Mail Received PY =
CALCULATE(
SUM('FACT - Mail Receipts'[Volume]),
SAMEPERIODLASTYEAR('DIM - Date Table'[Date]), 'DIM - Date Table'[Date] <= date(year(today()), month(today())-12, day(today()))
)
2 Replies
- amitchandak
Super User
NewbieJono , Try if this can help
Mail Received PY =
CALCULATE(
SUM('FACT - Mail Receipts'[Volume]),
SAMEPERIODLASTYEAR('DIM - Date Table'[Date]), 'DIM - Date Table'[Date] <= date(year(today()), month(today())-12, day(today()))
) - parry2k
Super User
NewbieJono I guess amitchandak measure will work, in case it doesn't, this will surely work:
LY MTD = CALCULATE ( [Sales], DATESMTD( SAMEPERIODLASTYEAR( CALCULATETABLE ( VALUES ( 'Calendar'[Date] ), 'Calendar'[Date] <= TODAY () ) ) )✨ Follow us on LinkedIn and to our YouTube channel
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.