Reputation: 108
I have a table that contains four columns months (Format: mmm-yy), staffs, sales, expenses. I want to create three bar graphs for staff, sales, and expenses with the month in the axis for each bar graph. I want to create a month filter so that if I select a particular month data of that month and previous two months should be shown in the graph.
When I select Aug 17 in the filter than data of only Jun-17, July-17 and Aug-17 should be shown in the bar graph
Upvotes: 2
Views: 19710
Reputation: 40204
I don't know if this is the best way to do this, but I can get it working as follows (I will assume your table name is Sales
):
SlicerTable = VALUES(Sales[MonthofYear])
3MonthSales =
VAR SelectedDate = SELECTEDVALUE(SlicerTable[MonthofYear])
VAR CurrentDate = SELECTEDVALUE(Sales[MonthofYear])
RETURN IF(CurrentDate <= SelectedDate &&
CurrentDate > EOMONTH(SelectedDate,-3),
SUM(Sales[Sales]), BLANK())
SlicerTable[MonthofYear]
and a bar chart on Sales[MonthofYear]
and Sales[3MonthSales]
and you should get something like this:Upvotes: 6