Abstract: In an embodiment, a computer-implemented method optimizes queries. The method includes (a) representing a filter criteria for data in a data source as a first Boolean statement with a plurality of expressions connected by a plurality of logic operators including at least one OR operator and at least one AND operator; (b) determining that an expression in the plurality of expressions is a measure expression; (c) analyzing the first Boolean statement to identify an expression in the plurality of expressions that will be ANDed with results of the determined measure expression; (d) replacing the measure expression determined in (b) with a statement ANDing the measure expression determined in (b) and the expression identified in (c) to determine a second Boolean statement that describes the filter criteria that the first Boolean statement represents; and (e) generating, based on the second Boolean statement, a sequence of queries.