Forum Discussion
TKhanca
1 year agoFrequent Visitor
How to calculate with different slicer value
Hello, I have two measures on the card visual with filter table1[Year]. First measure is fine and filtering counts based on the selection from the slicer. How can I calculate counts for a diffren...
- 1 year ago
Bibiano_Geraldo , thank you very much for your help.
REMOVEFILTERS(Term[Term_Code]) worked to solve this scenario.
Bibiano_Geraldo
Super User
1 year agoHi TKhanca ,
You can create a measure like this:
CountForYearMinus3 =
VAR SelectedYear = MAX('table1'[Year]) -- Get the selected year
VAR TargetYear = SelectedYear - 3 -- Calculate the target year
RETURN
CALCULATE(
COUNT('table2'[SomeColumn]), -- Replace 'SomeColumn' with the column you're counting
FILTER(
ALL('table1'), -- Remove current slicer filter from table1
'table1'[Year] = TargetYear
)
)If the slicer filters table1[Year] to 2024:
- SelectedYear will be 2024.
- TargetYear will be 2021.
- The measure will count rows in table2 where the year is 2021.
TKhanca
1 year agoFrequent Visitor
Thank you very much Bibiano for your help. It worked for Card but I have another Table visual where I need to use this measure with other columns but it always display the same value.
- Bibiano_Geraldo1 year ago
Super User
Can you show me a picture of your table visual?
- TKhanca1 year agoFrequent Visitor
Bibiano_Geraldo , thank you very much for your help.
REMOVEFILTERS(Term[Term_Code]) worked to solve this scenario.