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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
Community Champion
Community Champion

@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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.