Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
paalark
Regular Visitor

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 ?


1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community 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





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
paalark
Regular Visitor

Thank you Paul 🙂

PaulDBrown
Community Champion
Community 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





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.