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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
someone
Frequent Visitor

Using a Slicer to Always Display Previous 4 Rows without

I have gotten a request to make the report I'm working on always display the previous four quarters (without using multi-select) depending on which selection is made. The data is organized as follows:

 

catsdogs3.JPG  

 

The report looks like this:

catsdogs1.JPG

The request is so that when any quarter is selected it displays the previous four rows of quarters:

catsdogs2.JPG 

 

Any guidance and help on this would be greatly appreciate.

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @someone

1. In query editor, create an index column from 1.

   Then create a blank query, and write code in Advanced editor.

let
    Source = Table.SelectColumns(Sheet1,{"Quarter","Index"})
in
    Source

3.png

 

2. In Relationship View, create the relationship between two tables.

2.png

 

3. In Report view, create measures, then add [Measure 3] to the Visual Filter and show 1

Measure = SELECTEDVALUE(Query1[Index])

Measure 2 = [Measure]-4

Measure 3 = IF(MAX(Sheet1[Index])>=[Measure 2]&&MAX(Sheet1[Index])<[Measure],1,0)

1.png

 

Best Regards

Maggie

View solution in original post

7 REPLIES 7
v-juanli-msft
Community Support
Community Support

Hi @someone

1. In query editor, create an index column from 1.

   Then create a blank query, and write code in Advanced editor.

let
    Source = Table.SelectColumns(Sheet1,{"Quarter","Index"})
in
    Source

3.png

 

2. In Relationship View, create the relationship between two tables.

2.png

 

3. In Report view, create measures, then add [Measure 3] to the Visual Filter and show 1

Measure = SELECTEDVALUE(Query1[Index])

Measure 2 = [Measure]-4

Measure 3 = IF(MAX(Sheet1[Index])>=[Measure 2]&&MAX(Sheet1[Index])<[Measure],1,0)

1.png

 

Best Regards

Maggie

parry2k
Super User
Super User

Does your dataset have a date? If not then you can add a index column and then can be worked thru that. It will be good to know what your dataset looks like before giving the solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

My dataset does not have a date. The quarter format is a column with shorthand for fiscal year (the year) and quarter (quarter number). You can see it in this picture:catsdogs3.JPG

can you share data in excel ?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I am can't figure out how to attach a file to a post in this forum. Is there another way that would work?

you can share thru google drive or one drive



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
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.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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