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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
8B45830
Frequent Visitor

Change the table and column reference by changing slicer selection

Hello,

 

I am having trouble with changing table and column reference by changing slicer selection.

 

Basically I have Tables called Actuals F24, Actuals F23, Actuals F22 and so on. Each Actual table has data for revenues and expenses by months from Nov to Oct (as we have a different fiscal year than calendar year). The Actual table also contains date that is linked to Calendar table which summarizes to month for selection in slicer i.e. "Nov.2023, Dec.2023, and so on". I also have a measure called YTD Actual Data = TOTALYTD((SUM('Actuals F24'[Amount]) +0), 'Calendar'[Period],"10/30").

 

My goal is if a user selects any month which is between Nov.2022 to Oct.2023 than the above YTD Actual Data measure should reference table Actuals F23 i.e. YTD Actual Data = TOTALYTD((SUM('Actuals F23'[Amount]) +0), 'Calendar'[Period],"10/30"). If a user selects any month which is between Nov.2021 to Oct.2022 than the above YTD Actual Data measure should reference table Actuals F23 i.e. YTD Actual Data = TOTALYTD((SUM('Actuals F22'[Amount]) +0), 'Calendar'[Period],"10/30").

 

Really appreciate your help and many thanks

 

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @8B45830,

 

Can you please try this:

 

1. Combine your "Actuals F24", "Actuals F23", "Actuals F22", etc., into a single table called "Actuals". Add a new column called "Fiscal Year" to this table to distinguish between different years

Date Amount Fiscal Year
2023-11-01 100 F24

 

2. Create a Dynamic Measure

Dynamic YTD Actual Data = 
VAR SelectedMonth = MAX('Calendar'[Date]) // Assumes the slicer selects a single month
VAR FiscalYear =
    SWITCH(
        TRUE(),
        SelectedMonth >= DATE(2022, 11, 1) && SelectedMonth <= DATE(2023, 10, 31), "F24",
        SelectedMonth >= DATE(2021, 11, 1) && SelectedMonth <= DATE(2022, 10, 31), "F23",
        SelectedMonth >= DATE(2020, 11, 1) && SelectedMonth <= DATE(2021, 10, 31), "F22",
        "Unknown"
    )
RETURN
    CALCULATE(
        TOTALYTD(SUM('Actuals'[Amount]), 'Calendar'[Period], "10/30"),
        'Actuals'[Fiscal Year] = FiscalYear
    )

Hope this helps!


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thank you. I though about merging all tables to one, but I have measures which does calculations for variance like actual vs. budget, actual vs. prior year and it will be difficult to do those calculations with all data in one table.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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