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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Amyries
Frequent Visitor

Dynamic Sclier

Hello,

I have a table that includes the Fiscal Year (FY) field. I want to create a slicer such that when I select FY25, the data and visuals will display both FY24 and FY25. Or select FY24, display FY24 and FY23, and similarly for other years.
Data is here: (I can't attract files or links, just can capture them)

Amyries_0-1735206760463.png

 


As a newcomer to Power BI, I would greatly appreciate your assistance. Thank you!

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Amyries 

You will need a disconnected table (without relationship) as using column from a related table will show just what's been selected and then a measure referencing that table/column to be used as a visual filter

danextian_1-1735212254747.png

 

FY Filter = 
VAR SelectedFY =
    MAX ( FY[FY Number] )
VAR _FY = {
    "FY" & SelectedFY - 1,
    "FY" & SelectedFY
}
RETURN
    CALCULATE (
        COUNTROWS ( 'Date' ),
        KEEPFILTERS ( TREATAS ( _FY, 'Date'[Fiscal Year] ) )
    )

danextian_0-1735212218638.png

Please see the attached sample pbix.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
danextian
Super User
Super User

Hi @Amyries 

You will need a disconnected table (without relationship) as using column from a related table will show just what's been selected and then a measure referencing that table/column to be used as a visual filter

danextian_1-1735212254747.png

 

FY Filter = 
VAR SelectedFY =
    MAX ( FY[FY Number] )
VAR _FY = {
    "FY" & SelectedFY - 1,
    "FY" & SelectedFY
}
RETURN
    CALCULATE (
        COUNTROWS ( 'Date' ),
        KEEPFILTERS ( TREATAS ( _FY, 'Date'[Fiscal Year] ) )
    )

danextian_0-1735212218638.png

Please see the attached sample pbix.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you!

Hi @Amyries ,

If danextian's reply can help you, please remember to accept his reply as a solution to help the other members find it more quickly. Thank you!

Best Regards,
Dino Tao

Please accept my post as the solution.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
123abc
Community Champion
Community Champion

To create a slicer that dynamically filters the data to include the selected fiscal year (FY) and its preceding year, you can follow these steps in Power BI:

Please follow steps:

  • Go to the Modeling tab and select New Column.

  • Use the following DAX formula to create a new column, e.g., ShowFY:

     
    ShowFY = IF( 'Table'[FY] = "FY25" || 'Table'[FY] = "FY24", "FY25", IF( 'Table'[FY] = "FY24" || 'Table'[FY] = "FY23", "FY24", BLANK() ) )

Replace 'Table' with the name of your table. This column will create a filterable field based on the selected fiscal year and its preceding year.

  1. Create a Slicer:

    • Add the new ShowFY column to the Slicer visual in your Power BI report.
  2. Link the Slicer to Your Visuals:

    • Ensure that the slicer interacts with all relevant visuals by checking the Edit Interactions settings under the Format tab.
  3. Test the Slicer:

    • Select FY25 in the slicer. Your visuals should show data for both FY24 and FY25.
    • Select FY24, and your visuals should show data for both FY23 and FY24.

Let me know if you need further adjustments or explanations!

Thank you, but I Select FY24 as the visual just show data for FY23

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.