0

I am trying to show the last month Cost by default on the page in a Card visual. with no filter selected, it should show the last month Cost (in our case, show September Cost).

Measure Formula:

Cost (LM) = CALCULATE([Total Cost], PREVIOUSMONTH(DATESYTD('Calendar'[Date])))

I added DATESYTD as in this hack worked for Last Year's Cost measure.

2 Answers 2

1

Simply focus on PREVIOUSMONTH directly without DATESYTD since it is typically used for cumulative totals over a year and not only for the last month :

Cost (LM) = 
CALCULATE([Total Cost], PREVIOUSMONTH('Calendar'[Date]))
Sign up to request clarification or add additional context in comments.

Comments

0

I did some digging and I found out 2 issues:

  1. My calendar (which is automatically created by the CALENDAR() function) was taking the end of the maximum year and creating the calendar. (e.g. maximum available year is 2024, so the calendar was created until December 31, 2024). Solution: Create it till the last possible date or end of month of that date.
  2. I should have used DATESMTD instead of DATESYTD (Duh) (We thank Amira Bedhiafi from the comments for that).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.