Forum Discussion
Compare with previous year
- 2 years ago
BassG , Try following measure
% Attend = DIVIDE(SUM(Data[Actual Attendance]), sum(Data[Possible Attendance]))
Last Year = CALCULATE([% Attend], OFFSET(-4, all(Data[Year], Data[Quarter],Data[Setting]), ORDERBY(Data[Year],asc, Data[Quarter],asc)))file is attached
- Anonymous2 years ago
Hi BassG ,
You can add two tables to create slicers:And there is no relationship between tables:
Use these DAXs to create measures:
Selected year attendance % = VAR Y = SELECTEDVALUE(Slicer[Year]) VAR Q = SELECTEDVALUE(Slicer2[Quarter]) VAR ACTUAL = SUMX(FILTER('Table', 'Table'[Year] = Y && 'Table'[Quarter] = Q), 'Table'[Actual Attendance]) VAR POSSIBLE = SUMX(FILTER('Table', 'Table'[Year] = Y && 'Table'[Quarter] = Q), 'Table'[Possible Attendance]) RETURN DIVIDE(ACTUAL, POSSIBLE)Previous Year's quarter attendance % = VAR Y = SELECTEDVALUE(Slicer[Year]) VAR Q = SELECTEDVALUE(Slicer2[Quarter]) VAR ACTUAL = SUMX(FILTER('Table', 'Table'[Year] = Y - 1 && 'Table'[Quarter] = Q), 'Table'[Actual Attendance]) VAR POSSIBLE = SUMX(FILTER('Table', 'Table'[Year] = Y - 1 && 'Table'[Quarter] = Q), 'Table'[Possible Attendance]) RETURN DIVIDE(ACTUAL, POSSIBLE)Difference % = [Selected year attendance %] - [Previous Year's quarter attendance %]The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi BassG ,
You can add two tables to create slicers:
And there is no relationship between tables:
Use these DAXs to create measures:
Selected year attendance % =
VAR Y = SELECTEDVALUE(Slicer[Year])
VAR Q = SELECTEDVALUE(Slicer2[Quarter])
VAR ACTUAL = SUMX(FILTER('Table', 'Table'[Year] = Y && 'Table'[Quarter] = Q), 'Table'[Actual Attendance])
VAR POSSIBLE = SUMX(FILTER('Table', 'Table'[Year] = Y && 'Table'[Quarter] = Q), 'Table'[Possible Attendance])
RETURN
DIVIDE(ACTUAL, POSSIBLE)Previous Year's quarter attendance % =
VAR Y = SELECTEDVALUE(Slicer[Year])
VAR Q = SELECTEDVALUE(Slicer2[Quarter])
VAR ACTUAL = SUMX(FILTER('Table', 'Table'[Year] = Y - 1 && 'Table'[Quarter] = Q), 'Table'[Actual Attendance])
VAR POSSIBLE = SUMX(FILTER('Table', 'Table'[Year] = Y - 1 && 'Table'[Quarter] = Q), 'Table'[Possible Attendance])
RETURN
DIVIDE(ACTUAL, POSSIBLE)Difference % = [Selected year attendance %] - [Previous Year's quarter attendance %]
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.