Forum Discussion
clarkey1988
Helper II
5 years agoCalculate 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 s...
- 5 years ago
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,
KellyDid I answer your question? Mark my reply as a solution!
v-kelly-msft
Community Support
5 years agoHi 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
Did I answer your question? Mark my reply as a solution!