Forum Discussion
What is wrong with this formula?
- 1 year ago
you're trying to reference a column in a measure, but you're doing it in a row context-dependent way that doesn't work properly in a measure (which evaluates in filter context).
Use a Calculated Column if you need row-by-row evaluation
IncludeDate =
IF(
NOT ISBLANK('YourTable'[EDC Go-Live]),
IF('YourTable'[EDC Go-Live] >= 'YourTable'[First Date to Include], 1, 0),
BLANK()
)
Use a Measure only if aggregating (e.g., MIN, MAX, FIRSTDATE)
IncludeDateMeasure =
VAR EDCDate = SELECTEDVALUE('YourTable'[EDC Go-Live])
VAR FirstDate = SELECTEDVALUE('YourTable'[First Date to Include])
RETURN
IF(
NOT ISBLANK(EDCDate),
IF(EDCDate >= FirstDate, 1, 0),
BLANK()
)
This works only if a single value is in context (e.g., when filtering by row in a visual or drillthrough).
you're trying to reference a column in a measure, but you're doing it in a row context-dependent way that doesn't work properly in a measure (which evaluates in filter context).
Use a Calculated Column if you need row-by-row evaluation
IncludeDate =
IF(
NOT ISBLANK('YourTable'[EDC Go-Live]),
IF('YourTable'[EDC Go-Live] >= 'YourTable'[First Date to Include], 1, 0),
BLANK()
)
Use a Measure only if aggregating (e.g., MIN, MAX, FIRSTDATE)
IncludeDateMeasure =
VAR EDCDate = SELECTEDVALUE('YourTable'[EDC Go-Live])
VAR FirstDate = SELECTEDVALUE('YourTable'[First Date to Include])
RETURN
IF(
NOT ISBLANK(EDCDate),
IF(EDCDate >= FirstDate, 1, 0),
BLANK()
)
This works only if a single value is in context (e.g., when filtering by row in a visual or drillthrough).