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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dgreen1
Frequent Visitor

Why is CALCULATE() Requiring FILTER() to be used if it it is built in?

My calculate formula does not work without the FILTER() function in it even though I thought filter was a part of it, and filter does not work without another function like ALL() or ALLSELECTED() in it, and I don't think I really want either of those since the formula does not work once I remove filters from the filter pane. Can anyone possibly explain this?

This works:

CALCULATE([Total Inc], FILTER(ALLSELECTED(Append), Append[Rank2] = current_rank-1))

These do not work:
CALCULATE([Total Inc], FILTER(Append, Append[Rank2] = current_rank-1))
CALCULATE([Total Inc],  Append[Rank2] = current_rank-1)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dgreen1 

When you use FILTER within CALCULATE, you're explicitly defining a new filter context for the calculation. FILTER returns a table that is then used by CALCULATE to modify the existing filter context.

  1. Your Working Example: CALCULATE([Total Inc]FILTER(ALLSELECTED(Append), Append[Rank2] = current_rank-1)) works because it does two things:

    • ALLSELECTED(Append): This part is removing the filters from the table 'Append' but keeps filters that come from user interactions (like slicers or filters in the filter pane).
    • Append[Rank2] = current_rank-1: This part applies a new filter where column 'Rank2' value is equal to current_rank-1 .

  2. Why Other Formulas Don't Work:

    • CALCULATE([Total Inc], FILTER(Append, Append[Rank2] = current_rank-1)): Here, you are filtering the 'Append' table, but you are not removing any existing filters. If there are other filters in place that conflict with 'Append[Rank2] = current_rank-1', your result might be unexpected or blank.
    • CALCULATE([Total Inc],  Append[Rank2] = current_rank-1): This formula is not using FILTER, so the filter context is only altered by 'Append[Rank2] = current_rank-1'. If there are other existing filters on the table 'Append', they will remain in place and could conflict with your condition.

 

 

 

Best Regards,

Jayleny

 

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @dgreen1 

When you use FILTER within CALCULATE, you're explicitly defining a new filter context for the calculation. FILTER returns a table that is then used by CALCULATE to modify the existing filter context.

  1. Your Working Example: CALCULATE([Total Inc]FILTER(ALLSELECTED(Append), Append[Rank2] = current_rank-1)) works because it does two things:

    • ALLSELECTED(Append): This part is removing the filters from the table 'Append' but keeps filters that come from user interactions (like slicers or filters in the filter pane).
    • Append[Rank2] = current_rank-1: This part applies a new filter where column 'Rank2' value is equal to current_rank-1 .

  2. Why Other Formulas Don't Work:

    • CALCULATE([Total Inc], FILTER(Append, Append[Rank2] = current_rank-1)): Here, you are filtering the 'Append' table, but you are not removing any existing filters. If there are other filters in place that conflict with 'Append[Rank2] = current_rank-1', your result might be unexpected or blank.
    • CALCULATE([Total Inc],  Append[Rank2] = current_rank-1): This formula is not using FILTER, so the filter context is only altered by 'Append[Rank2] = current_rank-1'. If there are other existing filters on the table 'Append', they will remain in place and could conflict with your condition.

 

 

 

Best Regards,

Jayleny

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.