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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
frankhofmans
Helper IV
Helper IV

Range of quarters from selected quarter

hi PBI experts,

 

I have a date table with a direct relationship to date columns in other tables. In the date table, I have included a quarter offset. The current quarter is quarter offset 0, the previous quarter is -1, and so on. I want to create a quarterly report where the user can select a quarter in the slicer, for example, Q1 2024. I want to display several charts showing the selected quarter and the four preceding quarters. So, in this case, quarters -2, -3, -4, -5, and -6. How can I achieve this?

 

I also want to build a formula that calculates the number of results for the quarter that is 2 quarters prior to the selected quarter, so in this case, the result for quarter offset -4. Any suggestions?

 

Thanks in advance,

Regards, Frank

2 REPLIES 2
anmolmalviya05
Super User
Super User

Hi @frankhofmans, Hope you are doing good !

To achieve your goals in Power BI, you can leverage the quarter offset in your date table combined with DAX measures to handle the filtering and calculations for the preceding quarters. Here’s how to set up your quarterly report and create the specific formulas you need:

 

1. Setting Up the Date Table

Ensure that your date table has:

A Quarter Offset column (already present in your case).

A Quarter-Year column (e.g., "Q1 2024"), which will be used in the slicer.

 

2. Creating a Slicer for Quarter-Year

Add the Quarter-Year column from your date table to a slicer.

Ensure the slicer is set to single select mode.

 

3. Filtering the Visuals for the Selected and Preceding Quarters

To display the selected quarter and the four preceding quarters:

Create a new DAX measure for filtering the visuals:

 

Show Selected and Prior Quarters =

VAR SelectedQuarterOffset = MAX('Date'[Quarter Offset])

RETURN

IF(

'Date'[Quarter Offset] <= SelectedQuarterOffset &&

'Date'[Quarter Offset] >= SelectedQuarterOffset - 4,

1,

0

)

Apply this measure as a filter to your charts:

 

Drag the Show Selected and Prior Quarters measure to the Filters pane for the visual.

Set the filter condition to is 1.

 

Creating a Measure for the Quarter Two Periods Before

To calculate the number of results for the quarter that is two quarters prior to the selected quarter:

 

Create the following measure:

Results for -4 Quarter =

VAR SelectedQuarterOffset = MAX('Date'[Quarter Offset])

VAR TargetQuarterOffset = SelectedQuarterOffset - 2

RETURN

CALCULATE(

SUM('YourTable'[YourValueColumn]),

'Date'[Quarter Offset] = TargetQuarterOffset

)




 

Hi! Thanks for your reply. Which column do you add to the graph? Because if i add the column quarter-year to the graph, it only shows the selected quarter in the slicer

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Kudoed Authors