Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Why use the CALCULATE function on Power BI measures?

When I create measures on Power BI, I usually just go straight to the function I want to create. And that usually works. 

 

However, I often see other people using the CALCULATE function before the actual functions. I wonder why is that? 

 

EXAMPLE:

 

If I need to sum the numbers within a table, I might just create a new measure like this:
TotalSales = SUM('table'[column])

 

However, I often see people doing this, to achieve the same result:

TotalSales = CALCULATE(SUM('table'[column]))

 

So, what is exactly the advantage in putting CALCULATE in front of the measures, even when there doesn't seem to be an obvious need to it? 

 

 

Thanks  🙂 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

please refer to 

Power BI Tips - DAX Calculate Function (databear.com)

vxiaotang_0-1666605877851.png

 

Context Transition and Filters in CALCULATE - SQLBI

vxiaotang_1-1666605907611.png

 

CALCULATE function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

please refer to 

Power BI Tips - DAX Calculate Function (databear.com)

vxiaotang_0-1666605877851.png

 

Context Transition and Filters in CALCULATE - SQLBI

vxiaotang_1-1666605907611.png

 

CALCULATE function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , calculate is needed when you want to add filters.

example

calculate(Sum(Table[Value]), item[Brand] ="ABC")

 

refer

https://community.powerbi.com/t5/Community-Blog/The-CALCULATE-Function-In-Power-BI-DAX-Tutorial/ba-p/1944173

https://www.phdata.io/blog/the-calculate-function-in-power-bi/

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors