cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper II

## Calculate Percentage Change from previous Year

Hi,

I wonder if anyone can help me. I have the below measure which is calculating the percentage change of "Suppliers" from current month from the previous month.

So in 2021 January had 154 suppliers and February had 147 suppliers so the percentage change in suppliers is -5%.

However, instead, I need this to calculate the percentage change from the current month and year from the previous month and year.

So February 2021 had 147 suppliers and February 2020 had 151 suppliers. The percentage change would be -3%

I keep getting a column value error.

1 ACCEPTED SOLUTION
Community Support

Hi @clarkey1988 ,

First create a calendar table,then create a relationship between the 2 tables.

Create a measure as below:

``````Measure =
VAR _previous =
CALCULATE ( SUM ( 'Table'[Supplier] ), DATEADD ( 'Table'[date], -1, MONTH ) )
VAR _current =
CALCULATE (
SUM ( 'Table'[Supplier] ),
FILTER ( 'Table', 'Table'[date] = MAX ( 'Table'[date] ) )
)
RETURN
IF (
ISINSCOPE ( 'Table'[Month] ),
SUM ( 'Table'[Supplier] ),
FORMAT ( DIVIDE ( _current - _previous, _previous ), "percent" )
)
``````

And you will see:

For the related .pbix file,pls see attached.

Best Regards,
Kelly

2 REPLIES 2
Community Support

Hi @clarkey1988 ,

First create a calendar table,then create a relationship between the 2 tables.

Create a measure as below:

``````Measure =
VAR _previous =
CALCULATE ( SUM ( 'Table'[Supplier] ), DATEADD ( 'Table'[date], -1, MONTH ) )
VAR _current =
CALCULATE (
SUM ( 'Table'[Supplier] ),
FILTER ( 'Table', 'Table'[date] = MAX ( 'Table'[date] ) )
)
RETURN
IF (
ISINSCOPE ( 'Table'[Month] ),
SUM ( 'Table'[Supplier] ),
FORMAT ( DIVIDE ( _current - _previous, _previous ), "percent" )
)
``````

And you will see:

For the related .pbix file,pls see attached.

Best Regards,
Kelly

Super User

Your formula looks a little complex.  Have you considered using SAMEPERIODLASTYEAR ()  or one of the Quick Measures?

I also don't see the column error you mention.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors