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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
cody_s
Frequent Visitor

Measure for days around SELECTEDVALUE

Hello,

 

I'm trying to create a measure to apply a filter for the dates around a selected date in a date table ('Date Table') based on a selected date in the filter.

 

Functionally i would like to have it as either a 1 or a 0 to apply the filter on if the date is +/- 3 days on either side of the slicer. So if the chosen date is Jan 10, 2020, i would like the measure to be 1 for Jan 7, 2020 to Jan 13, 2020, and all other dates in the table to be 0. In the base case of no selection i would probably just want it to be a 1 if possible. My hope is to have this as a measure within the 'Date Table' so i can just pop this into other pages as required.

 

Any suggestions? I can get the selected value with SELECTEDVALUE, but its the application of the 1/0 thats got me stumped for the measure side.

 

thanks!

3 REPLIES 3
wdx223_Daniel
Super User
Super User

@cody_s think you need to date table, the table on slicer should have not relationship, then put one in the slicer, another one in your visual, like this

wdx223_Daniel_0-1608613665683.png

 

amitchandak
Super User
Super User

@cody_s , Try a measure like

 

new measure =
var _max = maxx(allselected('Date'),'Date'[Date])+3
var _min = maxx(allselected('Date'),'Date'[Date])-3
return
calculate( sum(Table[Value]), filter(all(Date),'Date'[Date] >=_min && 'Date'[Date] <=_max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thats not quite the solution that i'm thinking of. I'm thinking of a measure thats either 1 or 0 so i can apply it as a filter on my table as an "equals 1"

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.