Forum Discussion
Attendance - new column - Calculate function
Here are a few things to check:
Relationships: Ensure that there is a proper relationship between the tables involved (Pupils, Attendance Measures, and Attendance Dates). The relationship should be based on the date fields so that the calculation can flow correctly.
Date Filtering: Verify that your date filtering works as intended. The PREVIOUSYEAR function requires a date column. Ensure that your [Date] column in the Attendance Dates table contains appropriate date values.
Date Format: Make sure that the date format in your DAX function matches the format stored in your [Date] column. If your dates are stored as Date type, you should use a date format like DATE(2023, 8, 31) instead of "31/08/2023".
Here's the revised version of your DAX formula:
% Attend Last Year =
CALCULATE(
'Attendance Measures'[% Attend for period],
PREVIOUSYEAR('Attendance Dates'[Date])
)
If your PREVIOUSYEAR function is correctly set up, this formula should calculate the attendance percentage for each pupil for the previous year based on the dates in your Attendance Dates table.
If you're still encountering issues, it might be helpful to break down your problem further and check the individual components to identify where the problem lies. You can try testing each part of your formula separately in a DAX expression window to see if they return the expected results.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.