Forum Discussion
Anonymous
2 years agoNot applicable
Need Help with YTD Function
I am trying to plot a line chart using monthly revenue on Y-axis and Month on X-axis.
I created a measure for the monthly revenue
MonthlyRevenue =
TOTALMTD(
[Revenue],
'Order Date'[Date]
)
Now the issue is i want the the line chart to end at the current month which is septemeber and show the previous 11 months. How can i acheive this?
Now the issue is i want the the line chart to end at the current month which is septemeber and show the previous 11 months. How can i acheive this?
2 Replies
- parry2kSuper User
Anonymous
As a best practice, add a date dimension in your model and use it for time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools. Check the related videos on my YT channel
Add Date Dimension
Importance of Date Dimension
Time Intelligence PlaylistAfter adding a date table, add this measure:
Last 12 Month from Today = VAR __Today = EOMONTH ( TODAY (), 0 ) RETURN CALCULATE ( [Revenue], KEEPFILTERS ( DATESINPERIOD ( 'Date Table'[Date], __Today, -12, MONTH ) ) )Use above measure on y-axis and month/year columns from date table.
- Pizamka0Frequent Visitor
You can apply a date range filter from your dim table to this particular visual