The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
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!
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.
User | Count |
---|---|
75 | |
70 | |
40 | |
30 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
50 | |
46 |