Forum Discussion
Dynamic % Growth based on selected date slicer
- 5 years ago
Hi tracytran91 ,
Suppose you are comparing the past 3 months with the current month, you can create a measure like this:
Growth% = VAR _mindate = CALCULATE ( MIN ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) ) VAR _maxdate = CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) ) VAR last3month = CALCULATE ( SUM ( 'Table'[value] ), FILTER ( ALL ( 'Table' ), 'Table'[Date] >= _mindate && 'Table'[Date] <= _maxdate ) ) VAR currentmonth = CALCULATE ( SUM ( 'Table'[value] ), FILTER ( ALL ( 'Table' ), YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) && MONTH ( 'Table'[Date] ) = MONTH ( TODAY () ) ) ) RETURN DIVIDE ( currentmonth - last3month, last3month )Attached a sample file in the below, hopes to help you.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tracytran91 , With one date(using date table) with min and max
measure =
var _max = maxx(allselected(Data), Data[Date])
var _Min = minx(allselected(Data), Data[Date])
return
divide(calculate([measure],filter('Date', 'Date'[date] =_max)) -calculate([measure],filter('Date', 'Date'[date] =_min)),calculate([measure],filter('Date', 'Date'[date] =_min)))
With two date ranges
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.