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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors