# 13.8 CALCULATE: filter context बदला

Source: https://ravindrabagale.com/mr/powerbi/ch13-dax-data-analysis-expressions/13-8-calculate-the-most-important-function.html
Language: mr (Marathi with English technical terms)

CALCULATE(expression, filter1, filter2, …) expression बदललेल्या filter context मध्ये evaluate करतो. Filters add, replace किंवा remove होऊ शकतात.

Blinkit Sales = CALCULATE([Total Sales], Orders[Platform] = "Blinkit")

Amazon Now Sales = CALCULATE([Total Sales], Orders[Platform] = "Amazon Now")

Pune & Nashik Orders = CALCULATE([Total Orders], DarkStore[City] IN { "Pune", "Nashik" })

Blinkit Dairy Sales =
CALCULATE(
    [Total Sales],
    Orders[Platform] = "Blinkit",
    Product[Category] = "Dairy & Breakfast"
)

UPI Orders = CALCULATE([Total Orders], Orders[Payment Mode] = "UPI")

Discounted Sales = CALCULATE([Total Sales], Orders[Discount] > 0)

Orders[Platform]="Blinkit" हा त्याच column वरील existing filter replace करतो. म्हणून Amazon Now row वरही Blinkit Sales दिसू शकतो.

अनेक filter arguments AND ने जोडले जातात.

Existing filter सोबत intersection हवं असेल तर KEEPFILTERS(Orders[Platform] = "Blinkit") वापरा.

ALL, REMOVEFILTERS, USERELATIONSHIP आणि CROSSFILTER सारखे modifiersही वापरता येतात.

प्रत्येक example City आणि Platform matrix मध्ये चालवा. Slicer बदलून परिणाम समजून घ्या.

रवींद्र बागले यांची tip

Nashik selected असताना त्याच City column वर Pune filter दिला तर replacement होतो. दोन्ही अटी एकत्र हव्या असतील तर KEEPFILTERS विचारात घ्या. वेगळ्या related columns चा contextही तपासा.
