Forum Discussion
Slicer Selected Value Not Working in Calculated Column Logic
- 8 years ago
This following appears to be working:
Jan DCC Budget as Measure =
CALCULATE(SUM(Directs[Cost]),
FILTER(Directs, Directs[Effective] <= DATE(Directs[_Year Selected], 1, 5) && Directs[Expiration] >= DATE(Directs[_Year Selected], 1, 5)))
The following should be measure, you should use aggregation with cost
Jan DCC Budget as Measure = IF(Directs[Effective].[Date] <= DATE(Directs[_Year Selected], 1, 5) && Directs[Expiration].[Date] >= DATE(Directs[_Year Selected], 1, 5), SUM(Directs[Cost]), 0)
parry2k, thank you for the quick response, but unfortunately your suggestion doesn't work.
Directs[Effective].[Date] and Directs[Expiration].[Date] are Directs columns, not measures, so they are not valid for use in a measure. These are both red underlined.
I will try and see if using CALCULATE will work.
- parry2k8 years agoSuper User
Sorry I missed that, yes please sure calculate
- curtismob8 years agoHelper IV
I tried the following:
Jan DCC Budget as Measure =
CALCULATE(SUM(Directs[Cost]), Directs[Effective] <= DATE(Directs[_Year Selected], 1, 5), Directs[Expiration] >= DATE(Directs[_Year Selected], 1, 5))The above with the follwoing error.
A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
- curtismob8 years agoHelper IV
This following appears to be working:
Jan DCC Budget as Measure =
CALCULATE(SUM(Directs[Cost]),
FILTER(Directs, Directs[Effective] <= DATE(Directs[_Year Selected], 1, 5) && Directs[Expiration] >= DATE(Directs[_Year Selected], 1, 5)))- parry2k8 years agoSuper User
Sweet, good for you. There you go!!