Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anandakash
Employee
Employee

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 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anandakash ,

 

It is suggested to create two slicers as follows.

 

1.Sample data

vstephenmsft_0-1635400322259.png

 

2.Create a calendar table, and there's no relationship between two tables.

Table 2 = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

8.png

 

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)

9.png

 

4.Now you can filter.

10.png12.png

 

 

 

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.

 

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Anandakash ,

 

It is suggested to create two slicers as follows.

 

1.Sample data

vstephenmsft_0-1635400322259.png

 

2.Create a calendar table, and there's no relationship between two tables.

Table 2 = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

8.png

 

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)

9.png

 

4.Now you can filter.

10.png12.png

 

 

 

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.

 

amitchandak
Super User
Super 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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.