Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Joooshhh
Frequent Visitor

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?

Heeelp.png
2 REPLIES 2
Pizamka0
Frequent Visitor

You can apply a date range filter from your dim table to this particular visual 

parry2k
Super User
Super User

@Joooshhh 

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 Playlist

 

After 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.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.