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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Tani4ka
Helper II
Helper II

Preceeding 12 quarters from selected filter Q Year

Hello,

Would be grateful for some help resolving my case.

 

I need to create a measure that will allow users to see 9 quarters prior and including the one they select in the filter (10 quarters on the chart)

 

So far my measure works partially: the quarter users select shows only the 1st month values of the selected but other quarters are correctly displayed. I can't figure out why and how to make the selected quarter also showing the full 3 months values instead of one.

 

On the below you can see I selected Q4 25 and the value in the bar chart shoudl be 9.6M but it returns only 3.5 that matches the first month of Q4 25. 

Tani4ka_0-1771426327276.png

My measure is next:

 

Visits Last 13 Quarters =
VAR AnchorDate =
    COALESCE (
        SELECTEDVALUE ( 'dim_time'[Start of Quarter] ),  
        MAX (visits[date] )       
    )
VAR AxisQ = SELECTEDVALUE ( 'Presentation Calendar'[Start of Quarter] )
RETURN
CALCULATE (
    [Value],
    REMOVEFILTERS ( 'dim_time' ),                      
    KEEPFILTERS ( DATESINPERIOD ( 'dim_time'[Date], AnchorDate, -9, QUARTER ) ),
    TREATAS ( { AxisQ }, 'dim_time'[Start of Quarter] )
)

I tried to change the measure to use Quarter Year insted  but it's not in the date format hence the measure doesn't work. 

Visits - table with the date and the value 

dim_time - calendar that used for filters

Presentation Calendar - calendar used for measure .  (Presentation Calendar = dim_site)

 

Many thanks!

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hii @Tani4ka 

 

The issue happens because your selected quarter filter is restricting the date table to the first month only, and your AnchorDate comes from that filtered context. So for the selected quarter, DATESINPERIOD is anchored to the first month, not the full quarter.

You should anchor on the end of the selected quarter, not the start.

Visits Last 9 Quarters =
VAR AnchorDate =
    COALESCE(
        ENDOFQUARTER('dim_time'[Date]),
        MAX('dim_time'[Date])
    )
RETURN
CALCULATE(
    [Value],
    REMOVEFILTERS('dim_time'),
    DATESINPERIOD(
        'dim_time'[Date],
        AnchorDate,
        -9,
        QUARTER
    )
)

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

2 REPLIES 2
Tani4ka
Helper II
Helper II

Thank you  SOOOO MUCH! 

rohit1991
Super User
Super User

Hii @Tani4ka 

 

The issue happens because your selected quarter filter is restricting the date table to the first month only, and your AnchorDate comes from that filtered context. So for the selected quarter, DATESINPERIOD is anchored to the first month, not the full quarter.

You should anchor on the end of the selected quarter, not the start.

Visits Last 9 Quarters =
VAR AnchorDate =
    COALESCE(
        ENDOFQUARTER('dim_time'[Date]),
        MAX('dim_time'[Date])
    )
RETURN
CALCULATE(
    [Value],
    REMOVEFILTERS('dim_time'),
    DATESINPERIOD(
        'dim_time'[Date],
        AnchorDate,
        -9,
        QUARTER
    )
)

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.