Q is defined as the first moment of an area about the centroidal axis.
Although this sounds kind of mathematical, you already know how to make this type of calculation. It's exactly the same calculation you make to find the centroid:
an area times the distance from the area's centroid to a reference axis.
For Q, our reference axis is the centroidal axis for the entire shape (that is, the z axis).