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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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