Forum Discussion
Measure based on value at selected time.
- 1 year ago
Create a Calculated Column to Determine the Correct Position
In the scores table, create a calculated column to determine the employee's position at the time of the score. This column will use the Effective Date to find the correct position.
DAXPositionAtDate = VAR CurrentDate = 'Scores'[Date] VAR CurrentEmployee = 'Scores'[Employee] RETURN CALCULATE( MAX('Employees'[Position]), FILTER( 'Employees', 'Employees'[Name] = CurrentEmployee && 'Employees'[Effective Date] <= CurrentDate ) )Update the Score Calculation
Modify your SCORE_1 measure to use the PositionAtDate column instead of the static Position column.
DAXSCORE_1 = VAR CurrentPosition = SELECTEDVALUE('Scores'[PositionAtDate]) VAR CurrentAverage = SELECTEDVALUE('Scores'[Average 1]) RETURN SWITCH( TRUE(), CurrentPosition = "Position 1" && CurrentAverage >= 0.985, 3, CurrentPosition = "Position 1" && CurrentAverage >= 0.98, 2, CurrentPosition = "Position 1", 1, CurrentPosition = "Position 2" && CurrentAverage >= 0.99, 3, CurrentPosition = "Position 2" && CurrentAverage >= 0.985, 2, CurrentPosition = "Position 2", 1, CurrentPosition = "Position 3" && CurrentAverage >= 0.995, 3, CurrentPosition = "Position 3" && CurrentAverage >= 0.99, 2, CurrentPosition = "Position 3", 1, 0 )
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523