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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DKlerk
New Member

How to delete date filter and add new filter

Hello! 

I have a report with date slicers like year, quarter and month (dimCalendar) and a lot of other filters.  
In my table I would like to show the current month and the previous 12 months based on the selected date filters. 

dimCalendar contains 'YearMonthId' so I can add a filter like YearMonthId <= selected Max YearMonthId and >= selected YearMonthId - 12 to show the last 12 months but therefore I need to remove the other date filters (and most important keep all the other filters). 

 Can someone help me with this one please?

2 REPLIES 2
technolog
Super User
Super User

I hope this message finds you well. I've noticed that this solution remain unresolved. If any of you have managed to find a resolution to the issue, I kindly request that you share your solution for the benefit of the entire community. Alternatively, if you're still facing challenges, please do let us know as well.

Your insights and updates will greatly assist others who might be encountering the same challenge.

v-yueyunzh-msft
Community Support
Community Support

HI , @DKlerk 

According to your description, you want to show the previous 12 month value in your visual based on the [YearMonthId] slicer.

Here are the steps you can refer to :
(1)This is my test data , we do not need to create any relationship between tables:

vyueyunzhmsft_0-1693533159108.png

My Calendar Date table is created by dax code:

Calendar = ADDCOLUMNS( CALENDAR( FIRSTDATE('Table'[Date]) , LASTDATE('Table'[Date])) , "YearMonthId" , YEAR([Date])*100+MONTH([Date]))
 
(2)We can create a measure like this:
Measure = var _selected_year_month =MAX('Calendar'[Date])
var _cur_date =MAX('Table'[Date])
var _pre_12_month =  EOMONTH(_selected_year_month,-12)+1
var _last_date = EOMONTH(_selected_year_month,0)
return
IF(_cur_date>=_pre_12_month && _cur_date<=_last_date ,1,0)
 
Then we can put this measure on the "Filter on this visual" and then we can meet your need , the result is as follows:
vyueyunzhmsft_1-1693533243951.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.