Forum Discussion
what is the difference between All and AllSelected?
- 6 years ago
Hi SandipGhosh ,
The first formula, ALL removes any active filters from the columnA.
The second formula, ALL returns a table containing all columns.
About ALL and ALLSELECTED, we can create a sample to help you understand.
We want to calculate the total value of the name. So we create two measures, one uses ALL, another uses ALLSELECTED.
ALL function calculates the Total = CALCULATE(SUM('Table'[value]),ALL('Table'))ALLSELECTED calculates the Total = CALCULATE(SUM('Table'[value]),ALLSELECTED('Table'))We can see there is no difference between the last two measures, they are both 10.
Now we add a slicer based on Name and select A and B.
The rows become two, and the ALLSELECTED measure changed.
Because the ALLSELECTED function is affected by external filters, the Name slicer is one of external filters.
But the ALL function is not affected by external filters.
If you want to calculate the total that will not change, you can use ALL.
If you want to calculate the total that will change according to the slicer, you can use ALLSELECTED.
Maybe you can refer the following video, video explanation may help you.
https://www.youtube.com/watch?v=q4jePhzKtbU
https://www.youtube.com/watch?v=n_7Telypk2Q
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SandipGhosh - ALL removes all filters. ALLSELECTED removes filters inside the query but not those outside the query. Read up on ALLSELECTED before using it:
https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/
- SandipGhosh6 years agoFrequent Visitor
Hi, Is there any difference between
COUNTX(ALL(columnA)), columnA) and
COUNTX(ALL(tableA)), columnA)
, but I did not understand the
https://www.sqlbi.com/articles/the-definitive-guide-to-allselected/
it is very complex and lenthy for me.
- v-zhenbw-msft6 years ago
Community Support
Hi SandipGhosh ,
The first formula, ALL removes any active filters from the columnA.
The second formula, ALL returns a table containing all columns.
About ALL and ALLSELECTED, we can create a sample to help you understand.
We want to calculate the total value of the name. So we create two measures, one uses ALL, another uses ALLSELECTED.
ALL function calculates the Total = CALCULATE(SUM('Table'[value]),ALL('Table'))ALLSELECTED calculates the Total = CALCULATE(SUM('Table'[value]),ALLSELECTED('Table'))We can see there is no difference between the last two measures, they are both 10.
Now we add a slicer based on Name and select A and B.
The rows become two, and the ALLSELECTED measure changed.
Because the ALLSELECTED function is affected by external filters, the Name slicer is one of external filters.
But the ALL function is not affected by external filters.
If you want to calculate the total that will not change, you can use ALL.
If you want to calculate the total that will change according to the slicer, you can use ALLSELECTED.
Maybe you can refer the following video, video explanation may help you.
https://www.youtube.com/watch?v=q4jePhzKtbU
https://www.youtube.com/watch?v=n_7Telypk2Q
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.