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
staycool
New Member

YOY CALCULATION....

https://drive.google.com/file/d/1rXHBG2R5xuMtC0J-EwSaVsaunsjehjbf/view?usp=sharinghttps://drive.google.com/file/d/1siMKeL9KM2JerWBNoLyHpdgL_fFaF0yO/view?usp=sharing

 

I am trying to calculate YOY but not working...

 

total sales = sum('data'[gmv])
last year = CALCULATE('data'[total sales],DATEADD('table'[DATE].[Date],-1,year))
last year2 = CALCULATE( [total sales], SAMEPERIODLASTYEAR('table'[DATE].[Date]))
 
 
As you can see the image above, total sales , last year1 and 2  are all same.... 
I have attached the relationship of tables.
 
Thanks in advance.
Bests,
 
 
 
 
1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @staycool 

 

By my test, your formula is worked. You can have a try to the following steps to check your table.

 

1.Required the table about date is a calendar table , if you use a time intelligence function.

Capture0.PNG

2.Choose Modeling -->Manage Relationships. The relationship of two tables is many-to-one.

00.jpgCapture1.PNG

3.In report view, choose Modeling --> New Measure

DATEADD() and SAMEPERIODLASTYEAR() are related to the date, you need to add the date in the calendar table.

 

total sales = sum('data'[Gross Sales])

last year = CALCULATE('data'[total sales],DATEADD('Table2'[DATE].[Date],-1,year))

last year2 = CALCULATE( [total sales], SAMEPERIODLASTYEAR('Table 2'[Date].[Date]))

Different = IF( ISBLANK([last year2]),BLANK(),[last year2] -[total sales] )

YOY = [Different] / [last year2]

Capture3.PNG

 

Best Regards,

Xue Ding

 

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

Best Regards,
Xue Ding
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

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @staycool 

 

By my test, your formula is worked. You can have a try to the following steps to check your table.

 

1.Required the table about date is a calendar table , if you use a time intelligence function.

Capture0.PNG

2.Choose Modeling -->Manage Relationships. The relationship of two tables is many-to-one.

00.jpgCapture1.PNG

3.In report view, choose Modeling --> New Measure

DATEADD() and SAMEPERIODLASTYEAR() are related to the date, you need to add the date in the calendar table.

 

total sales = sum('data'[Gross Sales])

last year = CALCULATE('data'[total sales],DATEADD('Table2'[DATE].[Date],-1,year))

last year2 = CALCULATE( [total sales], SAMEPERIODLASTYEAR('Table 2'[Date].[Date]))

Different = IF( ISBLANK([last year2]),BLANK(),[last year2] -[total sales] )

YOY = [Different] / [last year2]

Capture3.PNG

 

Best Regards,

Xue Ding

 

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

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

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.