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
SBR1D
Helper III
Helper III

Help understanding measure

Hello 

 

I have been trying to understand a calculated column that my predecessor wrote.

 

The part i'm struggling to understand is the Filter All bit.

1) As its a calculated column why would you need to remove filters?

2) All with a column parameter returns all the unique values right?, I don't understand why you would use all here and not just Filter(All(Activities) 

 

 

Latest submission date = 

CALCULATE(
MAX(Activities[Submission date]) ,
FILTER ( ALL ( 'Activities'[LearnerID]) , 'Activities'[LearnerID] = LearningPlan[LearnerID])
)

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @SBR1D 

Thank you for your reply. ALL is used as a function to return a table when used in the Filter function.
The Values ​​function returns a column without duplicate values.

vjianpengmsft_0-1730270020110.png

vjianpengmsft_1-1730270200025.png

 

You may not have much impact on your results when using them in calculated columns, but they are usually used in measures and they play various roles.
Values ​​can only be used as table functions. ALL can be used as both a filter and a table function. When we need to clear the filter in some cases, we usually put it in the second parameter of calculate.

If you don't understand it, it's normal. I suggest you read the SQL BI article, which describes the differences and calculation logic in detail.

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI

Using ALLEXCEPT vs ALL + VALUES - SQLBI

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

12 REPLIES 12
Anonymous
Not applicable

Thank you Tahreem24

Hi, @SBR1D 

What the computed columns provide us is row context:

 Row context in DAX - SQLBI

vjianpengmsft_0-1730092382019.png

When we add the calculate function to this max function, the current context will become a filter context:

Here is the understanding of filter context:

Filter context in DAX - SQLBI

vjianpengmsft_1-1730092596218.png

The rows filtered out under these three row filters will be passed to the max function to calculate the maximum value: 10

vjianpengmsft_2-1730092743796.png

This further confirms that under the three column filter contexts, the maximum value is: 11

FILTER is an iterative function that returns a table. ALL ('Activities'[LearnerID]) will ignore the filter on this column, and LearningPlan[LearnerID] returns the LearnerID of the current row. Take my sample data as an example:

vjianpengmsft_3-1730093289436.png

In this case, if I have two other columns as filters: status, value, and 'Merge1'[Table 2.Task]='Merge1'[Table 2.Task] added in the filter function). With the combined effect of these filters, a table will be returned, and the max function will be calculated based on this table.

vjianpengmsft_4-1730093386438.png

If ALL table is selected, all rows will be returned, and then for these rows, 'Merge1'[Table 2.Task]='Merge1'[Table 2.Task] will be selected and returned to max for calculation.

You can learn more about how they work and how they are calculated in this article from SQLBI.

How CALCULATE works in DAX - SQLBI

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI

Filter Arguments in CALCULATE - SQLBI

 

 

Best Regards

Jianpeng Li

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

Furthermore if i add another computed column with the following code i get exactly the same result as my original computed column without the need of having to clear any filter on Activities[LearningPlanID]. 

This further adds confusion as to why need to clear the filter on Activities[LearningPlanID]

 

CALCULATE(
MAX(Activities[Submission date]) ,
FILTER ( VALUES ( 'Activities'[LearnerID]) , 'Activities'[LearnerID] = LearningPlan[LearnerID])
)

 

 

Firstly, thank you so much for going in to this level of detail but i still don't understand why we need to clear the filter on the line below  , and then we reapply that filter? That does not make sense to me.

 

ALL(Merge[Table2.Task])

 

When you FILTER Table2 why do we need to remove the filter from the ID, surely we want to FILTER the 2nd table by the ID of the row in the 1st table, so why remove the filter on the ID?

Anonymous
Not applicable

Hi, @SBR1D 

Thank you for your reply. ALL is used as a function to return a table when used in the Filter function.
The Values ​​function returns a column without duplicate values.

vjianpengmsft_0-1730270020110.png

vjianpengmsft_1-1730270200025.png

 

You may not have much impact on your results when using them in calculated columns, but they are usually used in measures and they play various roles.
Values ​​can only be used as table functions. ALL can be used as both a filter and a table function. When we need to clear the filter in some cases, we usually put it in the second parameter of calculate.

If you don't understand it, it's normal. I suggest you read the SQL BI article, which describes the differences and calculation logic in detail.

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI

Using ALLEXCEPT vs ALL + VALUES - SQLBI

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

I totally get difference between VALUES and ALL in measures. I just do not understand why ALL was used in the calculated column in my OP. The code was from my predecessor and i was trying to work out why she had used it. It seems it wasn't really needed though.

 

Thanks for your help.

SBR1D
Helper III
Helper III

so this line is returning all Activieis[LearnerID] where   Activieis[LearnerID] = LearningPlan[LearnerID]  ?

 

 

FILTER ( ALL ( 'Activities'[LearnerID]) , 'Activities'[LearnerID] = LearningPlan[LearnerID])
)

 

@SBR1D Yes!

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Tahreem24
Super User
Super User

@SBR1D ALL basically remove any filters applied. Coming to your point 2, Filter(All(Activities) it scans enter table with all columns which is not a good practice and lead to performance issue. And if you mention specific column inside ALL so it removes filter from that particular table. 

 

Putting it all together, your DAX formula calculates the maximum submission date for the learner specified in the LearningPlan by filtering the Activities table to only include records where the LearnerID matches. The use of ALL ensures that the filter context for LearnerID is ignored, allowing you to compare across all learners while still isolating the results to the specified learner.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Thanks for your reply but one thing is confusing me.

 

' The use of ALL ensures that the filter context for LearnerID is ignored, allowing you to compare across all learners while still isolating the results to the specified learner.'

 

Why would we want to ignore filter context for learnerid? We want to find the learnerid in activities that matches learnerid in learningplan right?

Why would the filter need to be removed for that?

 

@SBR1D Iit would remove any exisiting filters before compare it across all learners.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Kedar_Pande
Super User
Super User

@SBR1D ,

  1. Even in calculated columns, you might need to clear filters to ensure you're getting values from all rows, not just the current row context
  2. ALL('Activities'[LearnerID]) is more efficient as it only removes filters from one column
    FILTER(ALL(Activities)) would remove filters from the entire table, which is unnecessary here
    Using just the column is faster and uses less memory

 

// Less efficient
Latest = FILTER(ALL(Activities), condition)
// More efficient
Latest = FILTER(ALL(Activities[Column]), condition)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

Thanks for your reply.

 

Why do we need to clear filters in learningplan? We want to filter the learnerid in Activities by the learnerid in LearningPlan.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.