Forum Discussion
icdns
Post Patron
6 years agoSHOW LATEST 3 MONTH IN BAR GRAPH
Hi guys, Could somebody help me in displaying the LATEST 3 MONTHS data that will show in my bar graph. I have my DIM_CALENDAR and Date_Key as my dimension which is connected to my Date column in...
ibarrau
Super User
6 years agoHi. When I want to show last 3 months of the selected period I usually use this:
Measure L3M =
VAR _t = MAX('Date'[Date])
VAR _End = EOMONTH( _t , 0 )
VAR _Start = EOMONTH( _t , -3 ) +1
RETURN
CALCULATE (
[Measure],
DATESBETWEEN( 'Date'[Date] , _Start , _End )
)
Hope this helps,
- icdns6 years ago
Post Patron
Hi, ibarrau
I'm sorry for the confusion but it is NOT affected by my month filter. Only with the YEAR filter. So whatever my year is, it will only show the latest 3 months of data for that year.
Thanks! 🙂
- amitchandak6 years ago
Super User
icdns , Try like
LATEST_3_MONTHS =
var _max = calculate(MAX(FCT_TABLE[DATE]), filter(all(Date), Date[year] =selectedvalue(Date[Year])))
return
CALCULATE(sum(FCT_TABLE[ PERCENTAGE ]),DATESINPERIOD('DIM_CALENDAR'[FullDateAlternateKey],_max,-3,MONTH))