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
mtrussardi
Frequent Visitor

Year to Date Function

Hi,

 

I have table that shows sales for 3 different years (2018,2019,2020), and I would like to compare the difference in percentage of the sales year to date . For example: Sales accumulated from January 2020 until October 2020 and sales from January 2019 and October 2019. Is there any way I can compute a function that calculates this percentage automatically based on the same amount of months each year.

Here is what I am looking for: 

image.png

2 ACCEPTED SOLUTIONS
themistoklis
Community Champion
Community Champion

@mtrussardi 

 

Create 2 measures for YTD and LYTD and then calculate the percentage diff:

YTD = CALCULATE(SUM(Table6[Amount]),DATESYTD('Calendar'[Date]))

YTD LY = CALCULATE(Table6[YTD],SAMEPERIODLASTYEAR('Calendar'[Date]))

 

Measue = ([YTD] - [YTD LY]) / [YTD LY]

 

View solution in original post

@mtrussardi 

 

It seems that the Change % is a column and not a measure.

You should create a measure.

 

Also the table that you are showing us contains the raw data table.

What is the actual table that you are planning to use on the report. What fields and measures is it going to have?

View solution in original post

6 REPLIES 6
themistoklis
Community Champion
Community Champion

@mtrussardi 

 

Create 2 measures for YTD and LYTD and then calculate the percentage diff:

YTD = CALCULATE(SUM(Table6[Amount]),DATESYTD('Calendar'[Date]))

YTD LY = CALCULATE(Table6[YTD],SAMEPERIODLASTYEAR('Calendar'[Date]))

 

Measue = ([YTD] - [YTD LY]) / [YTD LY]

 

@themistoklis 

Thank you for your reply.

 

I have created the 2 measures and the column with percentage diff calculation. However, it returns an infinte sign. If it helps here a sample the table.

Screenshot 2020-10-27 123210.png

@mtrussardi 

 

Could you send a snapshot of the table on PowerBI where the infinite sign appears?

 

The table that you sent has only 2018 data. Could you share the PBIX file and mask any confidential data?

 

mtrussardi_0-1603820817011.png

This is the table that I am working on right now. Please, if you need the file let me know and I will dm you. Thanks in advance for your time.

@mtrussardi 

 

It seems that the Change % is a column and not a measure.

You should create a measure.

 

Also the table that you are showing us contains the raw data table.

What is the actual table that you are planning to use on the report. What fields and measures is it going to have?

@themistoklisThank you so much, now it is working

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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