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! Request now

Reply
Anonymous
Not applicable

Dynamic Monthly Filtering with Exception Handling

I'm facing a challenge in Power BI and would greatly appreciate your insights and suggestions to overcome it.

 

Here's my situation: I have a table with a date field and need to filter all the visuals in my report page by the current month. I've been using the filter page pane, dragging the date field, and utilizing relative date filters to achieve this. However, I've encountered an exception, when today's date is the 1st day of the month, there is no data available in my database for that day, resulting in empty visuals.

 

I'm seeking a solution that dynamically detects when it's the first day of the month. When this condition is met, I aim to display data for the previous month (e.g., if today is November 1st, I need to display data for the whole month, in this case, October). On other days, the filtering should simply show data for the current month (e.g., November).

I want this solution to be adaptable and change according to the current date.

Could you please share any ideas or techniques in Power BI that could help me address this scenario effectively? 

 

Thank you in advance for your support!

1 REPLY 1
AllisonKennedy
Super User
Super User

@Anonymous  - does your date table have a 'month offset' column? You could calculate the month offset, but alter this slightly to allow the buffer for today. You'd need to add an IF statement to check if the Day = 1, then MonthOffset-1. 

 

 

https://community.fabric.microsoft.com/t5/Desktop/Month-Offset-rolling-12-months/td-p/3240050 


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

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