Forum Discussion
BSM1985
Helper IV
6 years agoLast N Months
Hello Team, I have a bar chart with date on x-axis and profit on y-axis. The requireent is to have the buttons on top like "Last 1 Month", "Last 2 Months" and "Last 6 Months" as shown in attached...
Greg_Deckler
Community Champion
6 years agoBSM1985 You can do this with a column in your table where you flag items last 2 months, etc. Otherwise, you can do it in a measure like:
Measure =
VAR __Selected = MAX('Slicer'[Value])
VAR __Calc = <some calculation>
RETURN
IF(MAX('Date'[Date]) < TODAY() && MAX('Date'[Date])>=DATE(YEAR(TODAY()),MONTH(TODAY()),1),__Calc,BLANK())
As an example.