# KEEPFILTERS function

When we use the DAX function CALCULATE and give it the filter values as arguments as a result we will get a Power Pivot report filled with rows containing the same values. Although these values correspond to the given filter this way of displaying data is not the best solution. To make report neat, we can use the FILTER function or, even better, the KEEPFILTERS function about which you will learn more if you read the text that follows …

The syntax of the KEEPFILTES function is:

**KEEPFILTERS (<expression>)**

where as an expression we usually specify a column for whose values we want to keep the filters.

We calculate the total amount of sold quantities using the measure:

SalesK:=SUM([KOL])

If you want to see the amount of sold quantities for the manufacturer FRUVITA you will write the formula:

Prodaja FRUVITA:=CALCULATE([ProdajaK],Artikli[PROIZVOĐAČ]=”FRUVITA”)

If we add this measure to the Power Pivot report we will get identical rows containing value 3501000. If we want this value to be seen only for the given manufacturer we should “frame” the filter using the KEEPFILTERS function.

Prodaja FRUVITA KF:=CALCULATE([ProdajaK],KEEPFILTERS(Artikli[PROIZVOĐAČ]=”FRUVITA”))

If we add this measure to the report, it will look much better.