Forum Discussion
Need SELECTEDVALUE() in CALCULATED COLUMN
I know we cannot use SELECTEDVALUE() in a calcularted column but only in a measure.
But I cannot apply an aggreagte function in the measure on the date column im using in that measure. Please let me know the best way to achieve this. I have already wasted a lot of time to figure this out but no luck.
I want a calculated column like this:
Effective Date Logic =
var _selecteddate = CALCULATE(MIN('Calendar'[Date]), ALLSELECTED('Date'[Date]))
//this returns the default value only but not the selected value as its a calculated column
return
IF(
'Main'[EFFECTIVE_DATE] >= IF(_selecteddate=DATE(1900-01,01), TODAY(), _selecteddate),
TRUE,
FLASE
)
If I use the same logic in a calculated measure, the selectedvalue() returns the correct value but I cannot apply a AGG function on the EFFECTIVE_DATE column because it doesn't make sense for the output.
is there any dummy agg function I can apply here ?
You can use either MAX('Main'[EFFECTIVE_DATE]) or SELECTEDVALUE('Main'[EFFECTIVE_DATE]).
The filter context will make it return the "row" in the visual
2 Replies
- PaulDBrownCommunity Champion
You can use either MAX('Main'[EFFECTIVE_DATE]) or SELECTEDVALUE('Main'[EFFECTIVE_DATE]).
The filter context will make it return the "row" in the visual
- paalarkRegular Visitor
Thank you Paul 🙂