Set the type of your parameter to [switch], e.g.
param (
[switch]$lastmonth
);
EDIT:
Note that the variable will be a boolean. You can test it like:
if ($lastMonth) {
Write-Host "lastMonth is set."
}
else {
Write-Host "lastMonth is not set."
}
(thanks Chris)