Forum Discussion
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 🙂
Hi Anonymous
Thanks for reaching out to us.
please refer to
Power BI Tips - DAX Calculate Function (databear.com)
Context Transition and Filters in CALCULATE - SQLBI
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.
2 Replies
- amitchandak
Super User
Anonymous , calculate is needed when you want to add filters.
example
calculate(Sum(Table[Value]), item[Brand] ="ABC")
refer
https://www.phdata.io/blog/the-calculate-function-in-power-bi/
- v-xiaotang
Community Support
Hi Anonymous
Thanks for reaching out to us.
please refer to
Power BI Tips - DAX Calculate Function (databear.com)
Context Transition and Filters in CALCULATE - SQLBI
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.