Forum Discussion
HungFan
3 years agoRegular Visitor
Regarding using VALUES as a filter argument in CALCULATE
Hi all, I had learned that writing a measure of AllSalesCurrentYear, especially when computing a percentage over the grand total of only the current year, shall use VALUES('Date'[Year]) as a filter ...
- 3 years ago
VALUES() returns a table, which functions as filter in the calculation.
'Date'[Year] IN VALUES('Date'[Year]) is syntactic sugar for the CONTAINSROW(), it's interchangeable with
CONTAINSROW ( VALUES('Date'[Year]), 'Date'[Year] )in your case, an alternative to V1 is
= CALCULATE( [Sales Amount], ALLEXCEPT( 'Sales', 'Date'[Year] ) )
ThxAlot
Super User
3 years agoVALUES() returns a table, which functions as filter in the calculation.
'Date'[Year] IN VALUES('Date'[Year]) is syntactic sugar for the CONTAINSROW(), it's interchangeable with
CONTAINSROW (
VALUES('Date'[Year]),
'Date'[Year]
)
in your case, an alternative to V1 is
= CALCULATE( [Sales Amount], ALLEXCEPT( 'Sales', 'Date'[Year] ) )