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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
safy
Frequent Visitor

Filter last 12 months based on the Year, Month slicer selection

I have 2 slicers - one of them displays year while the other displays the month. I want my entire report to be filtered for the last 12 months based on the selected year and month combination. I have a date table with conitnuous dates. 

 

For Example: Year = 2025 and Month = Jul

Then my report needs to be filtered for the dates starting from 01-Aug-2024 until 30-Jul-2025. 

 

Is the only way is to re-create all measures again by changing the filter context so that they are evaulated for the last 12 months. Is there a way to make this work with just the base measures?

 

Example: If I have measure like this: 

 
BikeSales = CALCULATE (
    COALESCE ( [SalesAmt], 0 ),
    FILTER (
        'Dim Product',
        'Dim Product'[ProductName] = "Bikes"
    )
)

Then should I create another measure like below and similarly for every other measures. 

 

BikeSales P12M =
VAR SelectedDate =
MAX ( 'Dimension Period'[Date] )
VAR StartDate1 =
EOMONTH ( SelectedDate, -12 ) + 1
VAR EndDate1 =
IF (
ISFILTERED ( 'Dimension Period' ),
MAX ( 'Dimension Period'[Date] ),
MAXX (
'Dimension Period',
 'Dimension Period'[Date]
)
)
RETURN
CALCULATE (
COALESCE ( [SalesAmt], 0 ),

FILTER (
        'Dim Product',
        'Dim Product'[ProductName] = "Bikes"
    )

,
FILTER (
ALL ( 'Dimension Period' ),
'Dimension Period'[Date] >= StartDate
&& '01. Dimension Period'[Date] <= EndDate
)
)

 

1 ACCEPTED SOLUTION
Shahid12523
Community Champion
Community Champion

To filter your report for the last 12 months based on the Year and Month slicers without rewriting all measures:
- Create a disconnected date slicer table for Year and Month selections.
- Build a single DAX measure that calculates the date range (from 12 months before the selected year/month to the end of the selected month).
- Use this measure as a visual- or page-level filter to restrict data to that range.
- Keep your base measures unchanged, just apply this filter to visuals

Shahed Shaikh

View solution in original post

3 REPLIES 3
Shahid12523
Community Champion
Community Champion

To filter your report for the last 12 months based on the Year and Month slicers without rewriting all measures:
- Create a disconnected date slicer table for Year and Month selections.
- Build a single DAX measure that calculates the date range (from 12 months before the selected year/month to the end of the selected month).
- Use this measure as a visual- or page-level filter to restrict data to that range.
- Keep your base measures unchanged, just apply this filter to visuals

Shahed Shaikh

Thanks for the suggestion. This works but the dax measure has to be a visual filter and the Date field must be present in the visual. So I have to keep this as a matrix and keep the visual drilled to one level above the date. 

johnt75
Super User
Super User

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.