Forum Discussion
Create Dynamic Measure Tables using Values from Slicer
Hi Anonymous, Thanks for the reply. I have a different example to make it more clearer. The Below DAX script works fine if I use hardcoded date. But wont work when I use the SelectedValue('Date'[Year]) & SelectedValue('Date'[Month])
The PaxTable is a DAX Table generated Dynamically.
PaxTable =
VAR SelectedYear = 2024
VAR SelectedMonth = 2
//Create the calculated Table
VAR FilteredPAXTable =
CALCULATETABLE(
Staging_Table,
YEAR(Staging_Table[TravelDate]) = SelectedYear,
MONTH(Staging_Table[TravelDate]) = SelectedMonth
)
VAR TotalActuals =
CALCULATE(
[Actuals],
FilteredPAXTable
)
VAR DataTempTable =
DATATABLE(
"Category",STRING,"Actuals",INTEGER,
{{"none",0}}
)
VAR TempTable =
SELECTCOLUMNS(
DataTempTable,
"Category", "Total Passengers",
"Actuals", TotalActuals)
RETURN PaxTable
Hi Anonymous ,
As mentioned in previous replies, the slicer cannot affect the calculation table. The Calculation Columns and Calculation Tables will be calculated once when the data is first loaded and will be static until the data is refreshed. If you want the calculations to depend on the slicer, you need Measure, not the calculation columns or calculation tables.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.