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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
How to Implement PRESET DATE Filters and Dynamic Date Axis in an single Power BI Report?
Question:
Hello everyone,
I'm working on a Power BI report and need help implementing the following functionalities:
1. Preset Date Filters: I want to create a set of predefined date filters (like "Today", "Yesterday", "This Week","Last Week", "This Month", "Last Month", "This Quarter", "Last Quarter" "This Year", "Last Year", "Custom Range") that users can easily select without having to manually adjust the date slicer.
2. Dynamic Date Axis:
I need a date axis in my visuals that dynamically adjusts based on the selected date range, with specific behavior as follows:
These are useful, but i want them both combined and working "
https://www.youtube.com/watch?v=fKygF7VEJnQ
https://www.youtube.com/watch?v=hilfglpKNRQ
"
Could someone guide me on the best way to implement these functionalities? Any step-by-step approach, DAX expressions, or examples would be greatly appreciated.
Thanks in advance for your help!
Solved! Go to Solution.
Hi @manoj_0911 ,
I created some data:
Here are the steps you can follow:
1. Modeling – New parameter -- Fields.
2. Create measure.
Flag =
var _selectgroup=SELECTEDVALUE('Group_Table'[Group])
var _selectparameter=SELECTEDVALUE('Parameter'[Parameter])
var _parameterfield=SELECTEDVALUE('Parameter'[Parameter Fields])
var _today=TODAY()
return
SWITCH(
TRUE(),
_selectgroup="This Year"&&CONTAINSSTRING(_parameterfield,"Year")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today),1,
_selectgroup="Last Year"&&CONTAINSSTRING(_parameterfield,"Year")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)-1,1,
_selectgroup="This Week"&&CONTAINSSTRING(_parameterfield,"Date")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&WEEKNUM(MAX('Table'[Date]),2)=WEEKNUM(_today,2),1,
_selectgroup="Last Week"&&CONTAINSSTRING(_parameterfield,"Date")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&WEEKNUM(MAX('Table'[Date]),2)=WEEKNUM(_today,2)-1,1,
_selectgroup="This Month"&&CONTAINSSTRING(_parameterfield,"Week")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&MONTH(MAX('Table'[Date]))=MONTH(_today),1,
_selectgroup="Last Month"&&CONTAINSSTRING(_parameterfield,"Week")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&MONTH(MAX('Table'[Date]))=MONTH(_today)-1,1,0)
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @manoj_0911 ,
I created some data:
Here are the steps you can follow:
1. Modeling – New parameter -- Fields.
2. Create measure.
Flag =
var _selectgroup=SELECTEDVALUE('Group_Table'[Group])
var _selectparameter=SELECTEDVALUE('Parameter'[Parameter])
var _parameterfield=SELECTEDVALUE('Parameter'[Parameter Fields])
var _today=TODAY()
return
SWITCH(
TRUE(),
_selectgroup="This Year"&&CONTAINSSTRING(_parameterfield,"Year")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today),1,
_selectgroup="Last Year"&&CONTAINSSTRING(_parameterfield,"Year")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)-1,1,
_selectgroup="This Week"&&CONTAINSSTRING(_parameterfield,"Date")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&WEEKNUM(MAX('Table'[Date]),2)=WEEKNUM(_today,2),1,
_selectgroup="Last Week"&&CONTAINSSTRING(_parameterfield,"Date")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&WEEKNUM(MAX('Table'[Date]),2)=WEEKNUM(_today,2)-1,1,
_selectgroup="This Month"&&CONTAINSSTRING(_parameterfield,"Week")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&MONTH(MAX('Table'[Date]))=MONTH(_today),1,
_selectgroup="Last Month"&&CONTAINSSTRING(_parameterfield,"Week")=TRUE()&&YEAR(MAX('Table'[Date]))=YEAR(_today)&&MONTH(MAX('Table'[Date]))=MONTH(_today)-1,1,0)
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.