Forum Discussion
% change with random dates
- Anonymous5 years ago
Thank you - I tried the above but still got the same issue. Managed to fix it in the end by making the filter for the previousFTP calculation the same as the others (adding the bit in red):
VAR previousFTP =
CALCULATE (
SUM ( workouts[Avg. Watts] ),
FILTER (
ALL ( workouts ), SEARCH ( "FTP Test Ride", workouts[Title],, BLANK () ) > 0 &&
workouts[Date] = previousDatewithFTP
)
)Thank you for the advice!
try this version:
%FTP change =
VAR currentFTP =
CALCULATE (
SUM ( workouts[Avg. Watts] ),
FILTER (
ALL ( workouts), SEARCH ( "FTP Test Ride", workouts[Title],, BLANK () ) > 0 && workouts[Date] = MAX ( workouts[Date] )
)
)
VAR CD = MAX(workouts[Date])
VAR previousDatewithFTP =
CALCULATE (
MAX ( workouts[Date] ),
FILTER (
ALL ( workouts ), SEARCH ( "FTP Test Ride", workouts[Title],, BLANK () ) > 0 && workouts[Date] < CD
)
)
VAR previousFTP =
CALCULATE (
SUM ( workouts[Avg. Watts] ),
FILTER (
ALL ( workouts ),
workouts[Date] = previousDatewithFTP
)
)
RETURN
DIVIDE ( currentFTP - previousFTP, previousFTP, 0 )
Thank you - I tried the above but still got the same issue. Managed to fix it in the end by making the filter for the previousFTP calculation the same as the others (adding the bit in red):
VAR previousFTP =
CALCULATE (
SUM ( workouts[Avg. Watts] ),
FILTER (
ALL ( workouts ), SEARCH ( "FTP Test Ride", workouts[Title],, BLANK () ) > 0 &&
workouts[Date] = previousDatewithFTP
)
)
Thank you for the advice!