cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

New Member

## YOY CALCULATION....

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

total sales = sum('data'[gmv])
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.

Bests,

1 ACCEPTED SOLUTION
Community Support

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.

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

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 year2 = CALCULATE( [total sales], SAMEPERIODLASTYEAR('Table 2'[Date].[Date]))

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

YOY = [Different] / [last year2]

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.
Community Support

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.

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

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 year2 = CALCULATE( [total sales], SAMEPERIODLASTYEAR('Table 2'[Date].[Date]))

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

YOY = [Different] / [last year2]

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.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors