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)
camargos88
Community Champion
5 years agoMSC ,
_Average = CALCULATE(AVERAGE('Table'[Growth]), ALL('Table'[Product]), ALL(TABLE[Date]))
So you will ignore the selected date and get all the date values to calculate the average.
- MSC5 years ago
Helper III
camargos88I've used this function:
Average Measure =
VAR CustomerGroup_ =
DISTINCT(Data_Table[Customer])
RETURN
CALCULATE(AVERAGE(Data_Table2[Growth]), Data_Table[Category] IN CustomerGroup_, ALL(Data_Table[Customer]) )
Thanks a lot for your inputs and your help!