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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
smileamile2
Resolver I
Resolver I

One table, 2 date slicers that work as an "or" not "and"

I have two date slicers, Create Date and Close Date. Both are used as relative date slicers and will select a date range. I have one table that just returns a bunch of item detail data, no aggregations. I need the slicers to filter the table as an "or" condition, rather than "and".

 

If I select Create Date in Last 1 week and Close Date in Next 1 week, I should see all records that either have a Create Date in the last week OR a Close Date in the next week.  Since the slicers can return multiple values, I think I need to use "ALLSELECTED" function, but I am having trouble figuring out how to use it in a measure to filter the table with since I am not calculating any aggregations. Anyone have ideas?

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

Hi @smileamile2 

 

Create two another identical tables.

11.PNG

 

date 2 = ALLSELECTED('date'[date])

 

Apply two tables of date for two slicer respectively.

22.PNG

Then create a measure.

 

slicer_date = IF(SELECTEDVALUE('date'[date]) in VALUES('date 1'[date]) || SELECTEDVALUE('date'[date]) in VALUES('date 2'[date]),1,0)

 

44.PNG

 

Finally, put the measure on the data filter.

555.PNG

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Best Regards

Community Support Team _ Polly

View solution in original post

3 REPLIES 3
v-rongtiep-msft
Community Support
Community Support

Hi @smileamile2 

 

Create two another identical tables.

11.PNG

 

date 2 = ALLSELECTED('date'[date])

 

Apply two tables of date for two slicer respectively.

22.PNG

Then create a measure.

 

slicer_date = IF(SELECTEDVALUE('date'[date]) in VALUES('date 1'[date]) || SELECTEDVALUE('date'[date]) in VALUES('date 2'[date]),1,0)

 

44.PNG

 

Finally, put the measure on the data filter.

555.PNG

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Best Regards

Community Support Team _ Polly

amitchandak
Super User
Super User

@smileamile2 , As long as all other columns other than the measure you created are un summarized, measure will filter the table 

 

With independent date table

example

measure =
VAR _max = MAXX(allselected('Date1'),'Date1' [Date])
return
countrows(filter(Table, Table[Create Date] >=_max-7 && [Create Date] <= _max && Table[close Date] >=_max && [Close Date] <= _max +7 ))

 

 

use this measure with all other fields as un summarized in visual.

 

Or filter this value is not blank in the visual level filter

@amitchandak 

Well, I can't have the +-7 in the measure itself. I have relative date slicers that allow user to select any date range that can change

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors