Let P be a rational polytope. The Ehrhart function counts the number of lattice points in kP for all natural numbers k. The corresponding ordinary generating function is called the Ehrhart series, and is well known to be the power series expansion of a rational function at the origin.

From an abstract viewpoint counting of lattice points can be interpreted as integration of the constant 1 with respect to the counting measure defined by the lattice. We will discuss the generalization in which the constant 1 is replaced by a polynomial, and the generalized Ehrhart function is given by the assignment $k\mapsto \sum f(x)$ where the sum is extended over the lattice points in kP.

Our approach is based on Stanley decompositions and completely algorithmic. It has recently be implemented as a computer program. We will illustrate the computations by examples from combinatorial voting theory.