cancel
Showing results for
Did you mean:
Helper III

## Dynamic Last four quarters

Hi All

I would like get  X Axis as last four quarters based on the selected quarter and year in filters, example when i select Q4 in 2018, i want to show Q3,Q2,Q1 in 2018 and Q4 in 2017 in charts, if i select Q2 in 2018, i want to show Q1 in 2018 and Q4,Q3,Q2 in 2017 in charts

Please advise how can i acheive above mentioned results through functions or any other method

thank you

Regards

Jayanthan

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

## Re: Dynamic Last four quarters

1.copy the "date" table to create a new table "date2"

don't connect this new table to other tables

add "year" and "quarter" from table "date2" to the slicer

2. create measures in the Sheet7

measure_value = SUM(Sheet7[value])

selected_Y = SELECTEDVALUE(Date2[Year])

selected_Q = SELECTEDVALUE(Date2[Quarter])

flag =
IF (
MAX ( 'Date'[Year] ) = [selected_Y],
IF ( MAX ( 'Date'[Quarter] ) < [selected_Q], 1 ),
IF (
MAX ( 'Date'[Year] ) < [selected_Y],
IF ( MAX ( 'Date'[Quarter] ) >= [selected_Q], 1 )
)
)

3. add [flag] in the Visual level filter

Best Regards

Maggie

3 REPLIES 3
Anonymous
Not applicable

## Re: Dynamic Last four quarters

Hi jayanthan,

Try this:

Measure = CALCULATE(SUM(Table1[Value]),DATESINPERIOD('date'[Date],MAX('date'[Date]),-4,QUARTER))

https://community.powerbi.com/t5/Desktop/Accumulated-doing-accumulated-12-months-for-every-month-of-...

Tell us if works for you.

Community Support

## Re: Dynamic Last four quarters

1.copy the "date" table to create a new table "date2"

don't connect this new table to other tables

add "year" and "quarter" from table "date2" to the slicer

2. create measures in the Sheet7

measure_value = SUM(Sheet7[value])

selected_Y = SELECTEDVALUE(Date2[Year])

selected_Q = SELECTEDVALUE(Date2[Quarter])

flag =
IF (
MAX ( 'Date'[Year] ) = [selected_Y],
IF ( MAX ( 'Date'[Quarter] ) < [selected_Q], 1 ),
IF (
MAX ( 'Date'[Year] ) < [selected_Y],
IF ( MAX ( 'Date'[Quarter] ) >= [selected_Q], 1 )
)
)

3. add [flag] in the Visual level filter

Best Regards

Maggie

Helper III

## Re: Dynamic Last four quarters

Its was working , great , thank you for the support

Regards

Jayanthn

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

#### Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

#### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors