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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
giroldoale
Helper I
Helper I

when to use Calculate

Hi,

if I do not need to put a filter into Calculate, what would be the difference between these two expressions? 

CALCULATE(COUNT('OTD Details'[Somma di OC Number]))

COUNT('OTD Details'[Somma di OC Number])

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @giroldoale 

COUNT('OTD Details'[Somma di OC Number]): in a general situation, you can use this as a measure to put into the visual when the visualization already has the filter context. if it does not have the filter context, for instance, if you put this into the card visualization, the count from the first row until the last row will be measured.

 

-- CALCULATE(COUNT('OTD Details'[Somma di OC Number])): In a general situation, you can use this when creating a calculated column. When creating a calculated column, and if you do not use calculate function, it will count from the first row until the last row, because it did not define the filter context. However, if you use it with calculate, it defines the filter context and it will show the result of row by row.

 

I hope I explained well.

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi, @giroldoale 

COUNT('OTD Details'[Somma di OC Number]): in a general situation, you can use this as a measure to put into the visual when the visualization already has the filter context. if it does not have the filter context, for instance, if you put this into the card visualization, the count from the first row until the last row will be measured.

 

-- CALCULATE(COUNT('OTD Details'[Somma di OC Number])): In a general situation, you can use this when creating a calculated column. When creating a calculated column, and if you do not use calculate function, it will count from the first row until the last row, because it did not define the filter context. However, if you use it with calculate, it defines the filter context and it will show the result of row by row.

 

I hope I explained well.

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.