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
WishAskedSooner
Responsive Resident
Responsive Resident

Plotting YTD versus Full Prior YTD

Hi All,

 

Not sure if this has been asked before, but I am trying to plot the current running YTD against the full prior running YTD. This would essentially involve creating a table that looks like this that I can convert into a plot:

WishAskedSooner_0-1718678896477.png

WishAskedSooner_1-1718678937308.png

I have created an unconnected Date table that has contains all the months of 2024 to use as the x-axis since the connected Date table truncates at the last available date in the Fact table. I have created the following measure:

 

CurrYTD = CALCULATE(SUM('Fact'[Val]), ALL('DimProd'), 'Prod'[ID] = 1, DATESYTD(

TREATAS(VALUES('UnDimDates'[Date]), 'DimDates'[Date])))

 

And it seems to work, but I am not sure what the DAX would be for the Prior YTD. All of my attempts end up with a table that truncates in April for both the Current and Prior YTD. Like I said, I want the entire Prior YTD.

 

Also, I want the measure to be dynamic when the model updates with data in January of the next year.

 

Any help is appreciated!

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

I'm going to assume your data looks something like the following:

vicky__0-1718686906585.png Sales Table

vicky__2-1718687559488.png Date Table (note the year column is not necessary)

And i've created a relationship between the two.

and then i use the following calculations:

 

Sales YTD = CALCULATE(SUM('Table'[Sales]), DATESYTD('Calendar'[Date]))

Prev year sales = CALCULATE([Sales YTD], SAMEPERIODLASTYEAR('Calendar'[Date]))

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @WishAskedSooner ,

 

Thanks @vicky_ for his reply.

 

Have you tried the syntax he provided?

 

Did it help you solve the problem? If yes, please accept his answer as the solution, which will be of great help to users who encounter similar problems as yours.

 

If you have any further questions, please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

vicky_
Super User
Super User

I'm going to assume your data looks something like the following:

vicky__0-1718686906585.png Sales Table

vicky__2-1718687559488.png Date Table (note the year column is not necessary)

And i've created a relationship between the two.

and then i use the following calculations:

 

Sales YTD = CALCULATE(SUM('Table'[Sales]), DATESYTD('Calendar'[Date]))

Prev year sales = CALCULATE([Sales YTD], SAMEPERIODLASTYEAR('Calendar'[Date]))

 

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.