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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nanacobsbs
Helper I
Helper I

YTD calculation

Hi.
I have a budget control graph as shown below.

The bar graph is the actual YTD and the line graph is the budget YTD.
The code is as follows.
Actual YTD = CALCULATE('Budget Control'[Actual TTL],DATESYTD('Calender'[Date]))

I would like to link this graph to a slicer so that when the user selects a single month, the YTD of the bar graph for actual is displayed up to the month selected in the slicer and not beyond.
But I want the budget YTD to be displayed through December.
How should the code for the actual YTD be calculated?

Sorry for the rudimentary question, but please help.

 

 

sample.GIF

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @nanacobsbs ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1674024866199.png

Please try:

First duplicat the calendar table for slicer:

vjianbolimsft_1-1674024910679.png

Then apply the measrue:

Actual = IF(MAX('Calendar'[Date])<=MAX('For slicer'[Date]),SUM('Budget Control'[Actual TTL]))

SUM of Budget = IF(MAX('Calendar'[Date])<=MAX('For slicer'[Date]),SUM('Budget Control'[Budget]))

Final output:

vjianbolimsft_2-1674025096754.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @nanacobsbs ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1674024866199.png

Please try:

First duplicat the calendar table for slicer:

vjianbolimsft_1-1674024910679.png

Then apply the measrue:

Actual = IF(MAX('Calendar'[Date])<=MAX('For slicer'[Date]),SUM('Budget Control'[Actual TTL]))

SUM of Budget = IF(MAX('Calendar'[Date])<=MAX('For slicer'[Date]),SUM('Budget Control'[Budget]))

Final output:

vjianbolimsft_2-1674025096754.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you very much for your help!!

It works!!!

amitchandak
Super User
Super User

@nanacobsbs , Assuming Actual is a measure

You new measure should be . else you have to use sum( [Actual TTL])

 

Actual YTD = CALCULATE( [Actual TTL],DATESYTD('Calender'[Date]))

 

Also the axis and filter should be on Date table

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

If you select one month and want to display more than that

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your help!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.