Forum Discussion
Include and Exclude Radio Button for Date Filter
I have a visual that shows data relevant to selcted date range (using a Filter on visual level). Is there a possibility of having 2 buttons (1 include and other exclude) when selected, visual show data of the selected date range(if include is selected) and visual shows data of other than the selected date range( if exclude is selected).
For ex. let say i have selected show me data for last month
- selecting include -> want to see the last month data
- selecting exclude -> want to see other than the last month data (data< 1month)
Thanks in advance
- Anonymous4 years ago
Hi Anandakash ,
It is suggested to create two slicers as follows.
1.Sample data
2.Create a calendar table, and there's no relationship between two tables.
Table 2 = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))3.Create a measure and put it into Filters. Set 'Show items when the values is 1'.
Then the date columns of the two slicers come from different tables.
Measure = IF(ISFILTERED('Table 2'[Date]),IF(NOT(MAX('Table'[Date]) in ALLSELECTED('Table 2'[Date])) ,1),1)4.Now you can filter.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
Anandakash , for that you need an independent date table. and one table with two values include and exclude
here date1 is an independent date table, and Date is joined with table
measure =
var _max = maxx(allselected('Date1'), 'Date1'[Date])
var _min = maxx(allselected('Date1'), 'Date1'[Date])
return
if(selectedvalue(incExc[Incude]) = "Include" ,
calculate(sum(Table[Value]), filter('date', 'Date'[Date] >=_min && 'Date'[Date] <=_max )) ,
calculate(sum(Table[Value]), filter('date', 'Date'[Date] <_min && 'Date'[Date] >_max ))
)Need of an Independent Table in Power BI: https://youtu.be/lOEW-YUrAbE
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
- AnonymousNot applicable
Hi Anandakash ,
It is suggested to create two slicers as follows.
1.Sample data
2.Create a calendar table, and there's no relationship between two tables.
Table 2 = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))3.Create a measure and put it into Filters. Set 'Show items when the values is 1'.
Then the date columns of the two slicers come from different tables.
Measure = IF(ISFILTERED('Table 2'[Date]),IF(NOT(MAX('Table'[Date]) in ALLSELECTED('Table 2'[Date])) ,1),1)4.Now you can filter.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.