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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
AzureGuy
Regular Visitor

How to parametrize 'is in the previous' and 'is in the next' filters.

Hi all,

 

I am trying to filter data I am getting from SQL DW. I have some parameters and I can't apply them to "is in the previous" and "is in the next" filters. I can apply parameters to other filters with no problem (is before, is after, equals,...).

 

Did you know how to do that ? Please look at this image for more info.

 

Thanks,

Azure Guy

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

You could try editing the M code manually and see if it accepts your parameter as a value, not sure if it will for this or not - but click on the View tab in Power Query Editor to turn on Formula Bar. Then apply the filter as per your screenshot with 'is in the previous' 3 'years' , just put any number as the placeholder. Then update the formula in the formula bar to replace the '3' with the name of your parameter. Make sure your data type for the parameter is number.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

4 REPLIES 4
AllisonKennedy
Super User
Super User

You could try editing the M code manually and see if it accepts your parameter as a value, not sure if it will for this or not - but click on the View tab in Power Query Editor to turn on Formula Bar. Then apply the filter as per your screenshot with 'is in the previous' 3 'years' , just put any number as the placeholder. Then update the formula in the formula bar to replace the '3' with the name of your parameter. Make sure your data type for the parameter is number.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thanks Allison. This trick actually worked. It's weird we can't do that we the graphic tool but we can do that wit this workaround.

Anyway, thanks.

@AzureGuy , glad it worked! There are lots of scenarios like this where it can be done by editing the M code manually, but not using the User Interface, so keep this trick up your sleeve. 🙂

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@AzureGuy , you can use the relative date filter

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

Rolling formula with date table

Rolling 3 day = CALCULATE(sum(Table[Number]),DATESINPERIOD('Date'[Date],MAX(Table[Date]),-3,Day))

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-3,Day))

 

or refer

https://www.youtube.com/watch?v=duMSovyosXE

 

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.

Top Solution Authors