Forum Discussion
HB13
Helper I
4 years agoHow to create a dynamic DAX measure value that changes according to the filter applied on the visual
Hi all! I have this DAX measure in Power BI; CALCULATE ( SUM(Table1[amount]) , YEAR(Table2[date]) = 2021 ) This measure is used in a visual that is being filtered by a _DateTable[date], that ...
Adescrit
Impactful Individual
4 years agoHi HB13
You could try:
Measure =
VAR __SelectedYear = SELECTEDVALUE(DateTable[Year])
RETURN
CALCULATE ( SUM(Table1[amount]) , YEAR(Table2[date]) = __SelectedYear )
I'm assuming there is a column [Year] in the DateTable for this to work.
- Adescrit4 years ago
Impactful Individual
This may be over-complicating things though. If your Table1 is connected to DateTable via a date column in both, then your formula only needs to be the below. You can then create a YEAR column in your date table and use that to filter Table1.
CALCULATE ( SUM(Table1[amount]) ) - HB134 years ago
Helper I
This worked beautifully! Thank you so so much!!