cancel
Showing results for 
Search instead for 
Did you mean: 
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
Community Champion
Community Champion

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/

View solution in original post

1 REPLY 1
Jihwan_Kim
Community Champion
Community Champion

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/

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors