Forum Discussion
Anonymous
7 years agoNot applicable
Transforming a Calculated Column into a Variable inside a Measure
I have the following Calculated column to figure out if which rows hold the latest versions of data MaxDate = CALCULATE(MAX(ProjectsTable[Metric Date]),FILTER(ProjectsTable, Projects[Project Name]=E...
- 2 years ago
To transform your calculated columns into a measure, you need to adjust your DAX code to handle row context within a measure. Here's how you can create a measure that identifies the latest version of data dynamically:
LatestValueMeasure = VAR MaxDatePerProject = CALCULATE( MAX(ProjectsTable[Metric Date]), ALLEXCEPT(ProjectsTable, ProjectsTable[Project Name]) ) RETURN IF( MAX(ProjectsTable[Metric Date]) = MaxDatePerProject, 1, 0 )
technolog
Super User
2 years agoTo transform your calculated columns into a measure, you need to adjust your DAX code to handle row context within a measure. Here's how you can create a measure that identifies the latest version of data dynamically:
LatestValueMeasure =
VAR MaxDatePerProject =
CALCULATE(
MAX(ProjectsTable[Metric Date]),
ALLEXCEPT(ProjectsTable, ProjectsTable[Project Name])
)
RETURN
IF(
MAX(ProjectsTable[Metric Date]) = MaxDatePerProject,
1,
0
)