Forum Discussion
How to Use Measures in Calculated Columns?
Hi all,
I have a report I'm building with a long list of employees, their start date, and end date. I have a slicer that is linked to a date table. I have created two measures based on the slicer:
/* First date in slicer:
Selected Value MIN = CALCULATE(MIN('DATE Dim'[DATE]),ALLSELECTED('DATE Dim'))
/* Second date in slicer:
Selected Value MAX = CALCULATE(MAX('DATE Dim'[DATE]),ALLSELECTED('DATE Dim'))
I am now looking to create a calculated column (I believe this is the only way, as it needs to be calculated per each row) that calculates the days worked within the slicer dates.
2 Replies
- johnt75
Super User
Calculated columns are only calculated during data refresh so they don't take into account any slicers or filters. If you need something which reacts with slicers and filters you will need to create a measure, not a column.
You can turn your code for a calculated column into a measure by wrapping every column reference in SELECTEDVALUE().