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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
SandipGhosh
Frequent Visitor

what is the difference between All and AllSelected?

what is the difference between All and AllSelected?

1 ACCEPTED SOLUTION

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.

 

W1.jpg

 

ALL function calculates the Total = CALCULATE(SUM('Table'[value]),ALL('Table'))
ALLSELECTED calculates the Total = CALCULATE(SUM('Table'[value]),ALLSELECTED('Table'))

 

W2.jpg

 

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.

 

W3.jpg

 

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.

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@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/

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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.

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.

 

W1.jpg

 

ALL function calculates the Total = CALCULATE(SUM('Table'[value]),ALL('Table'))
ALLSELECTED calculates the Total = CALCULATE(SUM('Table'[value]),ALLSELECTED('Table'))

 

W2.jpg

 

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.

 

W3.jpg

 

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.

parry2k
Super User
Super User

@SandipGhosh let's assume you have a date table starting Jan 01st, 2019 and dec, 31st, 2020 and you have put a slicer on the date column and in slicer, you selected Jan 01st, 2020 to Aug 31st, 2020 

 

if you use ALL function in your measure, it will ignore the filter and all the dates.

if you use ALLSELECTED function in your measure, it will give you a full range of selected dates.

 

All Measure = CALCULATE ( SUM (Table[Amount] ) , ALL ( DateTable ) )

Allselected Measure = CALCULATE ( SUM ( Table[Amount], ALLSELECTED( DateTabe ) )

 

 

Assuming you have $100000 sales in 2019, 2020, and from Jan 01st, 2020 to Aug 31st, 2020 (Slicer selection), sales is $20000

 

if you add a table visual and date from the date table and above two measures, for each date, for ALL Meaasure you will get the value of $100000 and for ALLselected measure you will get the value of $20000

 

  

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@SandipGhosh ,

refer  this https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.