Census has been taken in Bavaria as early as 1770. The earlier censuses were only for statistical purposes. The census of December 1852 gave more details regarding the population. Age, gender, religion, occupations and buildings were registered. The same information was given in December 1867.
For more information see http://www.historisches-lexikon-bayerns.de/artikel/artikel_44809 also http://www.demogr.mpg.de/papers/working/wp-2009-023.pdf