Forum Discussion
TCavins
Helper V
1 year agoTable % Change from Previous Row
I have a simple table that has 2 columns. Year SUM Units I would like to add a third column that gets the % Change of Sum Units for each row compared to the previous year. I'm likely overthi...
- 1 year ago
Here's the solution I developed combining various sources I found. It may not be the most condensed but it works:
Units % Changed = VAR CurrentRowDate = MAX(MYTABLE[Year]) var currentUnits = CALCULATE( SUM(MYTABLE[Units]), FILTER( ALLSELECTED(MYTABLE), MYTABLE[Year] = CurrentRowDate)) VAR previousUnits = CALCULATE( SUM(MYTABLE[Units]), FILTER( ALLSELECTED(MYTABLE), MYTABLE[Year] = CALCULATE ( MAX(MYTABLE[Year]), FILTER(ALLSELECTED(MYTABLE), MYTABLE[Year] < CurrentRowDate) ) ) ) var percentChanged = (currentUnits - previousUnits) / previousUnits RETURN IF(ISBLANK(previousUnits), BLANK(),percentChanged)
FBergamaschi
Super User
1 year agoHere
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI