How to do it...

To complete this recipe, do the following:

  1. Use an Enter Data query to create a table called R08_Attendance with the following data:

  1. Create the following measure:
Attendance = 
VAR __Training =
CALCULATE(
MAX('R08_Training'[Training]),
ALLEXCEPT('R08_Training','R08_Training'[Training])
)
VAR __TrainingDate =
MAXX(
FILTER(
ALL('R08_Training'),
'R08_Training'[Training] = __Training
),
[Date]
)
RETURN
IF(
COUNTROWS(
FILTER('R08_Hours','R08_Hours'[Week] = __TrainingDate)
) >= 1,
IF(
ISBLANK(MAX('R08_Training'[Date])),
"Not Attended",
"Attended"
),
BLANK()
)
  1. Create the following additional measure:
Worked = 
VAR __Training =
CALCULATE(
MAX('R08_Training'[Training]),
ALLEXCEPT('R08_Training','R08_Training'[Training])
)
VAR __TrainingDate =
MAXX(
FILTER(
ALL('R08_Training'),
'R08_Training'[Training] = __Training
),
'R08_Training'[Date]
)
RETURN
IF(
COUNTROWS(
FILTER('R08_Hours','R08_Hours'[Week] = __TrainingDate)
) >= 1,
TRUE(),
FALSE()
)
  1. Create the following additional measures:
Attended = 
IF([Worked],
IF(
ISBLANK(MAX('R08_Training'[Date])),
BLANK(),
"Attended"
),
BLANK()
)

NotAttended =
IF([Worked],
IF(
ISBLANK(MAX('R08_Training'[Date])),
"Not Attended",
BLANK()
),
BLANK()
)

Attendance Measure to Show =
IF(HASONEVALUE('R08_Attendance'[Attendance]),
SWITCH(
MAX('R08_Attendance'[Attendance]),
"Attended",[Attended],
"Not Attended",[NotAttended]
),
MAX('R08_Training'[Date])
)
  1. On a Report page, create a Matrix visualization and place the Employee column from the R08_Employees table into the Rows area of the visualization.
  2. In the same Matrix visualization, place the Training column from the R08_Training table into the Columns area of the visualization.
  3. In the same Matrix visualization, place the Attendance measure into the Values area.
  1. On the same Report page, create a Slicer visualization and place the Attendance column from the R08_Attendance table into the Fields area.
  2. On the same Report page, create a second Matrix visualization and place the Employee column from the R08_Employees table into the Rows area of the visualization.
  3. In this second Matrix visualization, place the Training column from the R08_Training table into the Columns area of the visualization.
  4. In this second Matrix visualization, place the Attendance Measures to Show measure into the Values area.