Days past ovulation

How do you calculate dpo? Do you count the number of days from the last day of your fertile period? How many days past ovulation can you take a pregnancy test