Forum Discussion
8B45830
2 years agoFrequent 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 t...
Sahir_Maharaj
Super User
2 years agoHello 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!
8B45830
2 years agoFrequent Visitor
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.