Forum Discussion
HB13
4 years agoHelper I
How 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
4 years agoImpactful Individual
Hi 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 agoImpactful 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 agoHelper I
This worked beautifully! Thank you so so much!!