Forum Discussion
Unable to use selectedvalue variable in a calculated table
- 1 year ago
SELECTEDVALUE works in measures and visuals, where the context is dynamically applied by slicers or filters in the report. However, calculated tables are static after being created, and they are not updated dynamically when slicers are applied. Hence, using SELECTEDVALUE in a calculated table won't update the table in response to slicers.
> If you want the table to update dynamically based on the user's selection of Dw_snapshotdate from a slicer, you must create a measure rather than a calculated table.
Create a measure to filter dynamically:
Filtered_UCode_Measure =
VAR CurrentSnap = SELECTEDVALUE(Snapshoptdate[Dw_snapshotdate])
RETURN
CALCULATE(
SELECTCOLUMNS(
'R_Yearly_Summary_Measures',
"UCode", 'R_Yearly_Summary_Measures'[Ucode]
),
'R_Yearly_Summary_Measures'[Dw_snapshotdate] = CurrentSnap
)💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
mdgene , Try using below mentioned DAX
First_Table =
VAR CurrentSnap =
IF(
ISBLANK(SELECTEDVALUE(Snapshoptdate[Dw_snapshotdate])),
MAX(Snapshoptdate[Dw_snapshotdate]),
SELECTEDVALUE(Snapshoptdate[Dw_snapshotdate])
)
VAR TableA =
CALCULATETABLE(
SELECTCOLUMNS(
'R_Yearly_Summary_Measures',
"UCode", 'R_Yearly_Summary_Measures'[Ucode]
),
'R_Yearly_Summary_Measures'[Dw_snapshotdate] = CurrentSnap
)
RETURN
TableA
bhanu_gautam i tried it, but it only returns the maxdate and does not respond to the filter selection