Forum Discussion
Sunilrane
4 years agoNew Member
How to calculate % Change
Hi everyone, I need some help to calculate percentage change of the following example pasted below [All Periods] [$] CYTD Wks - 5 02/05/22 $1,452,541,355 CYTD Wks PY - 5 02/05/21...
- 4 years ago
Hi Sunilrane,
It seems that there are only two columns in your table:
So you may create two columns to extract the Date and the Type:
Date = RIGHT ( [[All Periods]]], 8 )Type = VAR _findWks = FIND ( "Wks", [[All Periods]]] ) RETURN LEFT ( [[All Periods]]], _findWks + 2 )Output:
Then create a measure
Changed Percentage = VAR _current = SUM ( 'Table'[[$]]] ) VAR _previous = CALCULATE ( SUM ( 'Table'[[$]]] ), FILTER ( ALL ( 'Table' ), [Type] = MAX ( 'Table'[Type] ) && YEAR ( [Date] ) = YEAR ( MAX ( 'Table'[Date] ) ) - 1 ) ) RETURN DIVIDE ( _previous, ( _current - _previous ) )And change the format to Percentage
The final output:
Best Regards,
Jinwei Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BeaBF
Super User
4 years agoSunilrane If you have a Table named Tabella 5 like this:
you can calculate the percentage change between the same period of the two years with this measure:
Misura 2 =
VAR MAXD = CALCULATE(MAX('Tabella (5)'[Date]))
VAR SUMMAX = CALCULATE(SUM('Tabella (5)'[[$]]]),'Tabella (5)'[Date] = MAXD)
VAR PREVYE = CALCULATE(SAMEPERIODLASTYEAR('Tabella (5)'[Date]))
VAR SUMPREV = CALCULATE(SUM('Tabella (5)'[[$]]]),'Tabella (5)'[Date] = PREVYE)
RETURN SUMMAX - PREVYE
BF