Forum Discussion
MSC
Helper III
5 years agoCalculate sales growth using calculated column
Hi everyone! I'd like to create a calculated column which returns the growth rate of my product sales. I've already managed to do with by means of measures but failed with a calculated column. Fo...
- 5 years ago
MSC ,
Try this code for a new calculated column:
Growth = VAR _lastDate = MAXX(FILTER('Table', 'Table'[Product] = EARLIER('Table'[Product]) && [Date] < EARLIER('Table'[Date])), 'Table'[Date]) VAR _lastValue = CALCULATE(SUM('Table'[Sales]), FILTER('Table', 'Table'[Product] = EARLIER('Table'[Product]) && [Date] = _lastDate)) RETURN IF(_lastValue <> BLANK(), ('Table'[Sales] - _lastValue) / _lastValue)
MSC
Helper III
5 years agoAshish_MathurI've uploaded a little demo dashboard with the DAX functions provided by camargos88 which shows the results I'd like to get. If you've a measure solution, you're welcome.
However, the functions don't work with my real dataset even though the underlying data has the same structure as the demo data. At the moment, I'm trying to figure out why this happens.