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

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

Reply
CharlotteB
Helper II
Helper II

Creating a date What-If parameter

I have a filter that displays end-of-month values. I want to show, from that specific point that the user selects, the data that is one year previous and the data that is one year in the future. How would I go about this? I would love it to default show me those values when I choose the end of month. Thank you in advance.

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @CharlotteB 

>> from that specific point that the user selects, the data that is one year previous and the data that is one year in the future

Please try this measure, and put it into visual level filter and set it to 1

 

Measure = 
var _date=SELECTEDVALUE('Date'[Date])
var _start=EDATE(_date,-12)
var _end=EDATE(_date,12)
return IF(MAX('Table'[Date])>=_start&&MAX('Table'[Date])<=_end,1,0)

 

result

vxiaotang_0-1669886964604.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @CharlotteB 

>> from that specific point that the user selects, the data that is one year previous and the data that is one year in the future

Please try this measure, and put it into visual level filter and set it to 1

 

Measure = 
var _date=SELECTEDVALUE('Date'[Date])
var _start=EDATE(_date,-12)
var _end=EDATE(_date,12)
return IF(MAX('Table'[Date])>=_start&&MAX('Table'[Date])<=_end,1,0)

 

result

vxiaotang_0-1669886964604.png

 

Best Regards,

Community Support Team _Tang

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

@v-xiaotang I tried this but it isn't working for me - what is the "DateSelected" measure that you made?

amitchandak
Super User
Super User

@CharlotteB , for end of month values you can have flag like this in date table use that as filter/slicer 

 

=if([Date] = eomonth([Date],0), 1, 0)

 

Or you can use closingbalancemonth: https://youtu.be/yPQ9UV37LOU

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.