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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
asif999
Frequent Visitor

All Function Not Working as expected !!!

I’m trying to calculate the distinct count of 'Live Order Status' for each OID, and I want to ignore any filters coming from the 'Live Order Status' and 'Supplier SKU' columns in the matrix
and keeping the filters from the OID column

1746475830128.png


1746472977488.png

Here’s the DAX measure I used:

Multi Status =
CALCULATE(
    DISTINCTCOUNT(
        Orders[Live Order Status]
    ),
    ALL(
        Orders[Live Order Status],
        Orders[Supplier SKU]
    )
)

 


But this is not giving the expected result. It looks like some filters from the visual or other related tables are still being applied.

When I use ALLEXCEPT() instead of ALL(), it works fine.

I’ve also shared a screenshot of my table relationships. Can you help me understand why ALL() is not working as expected here?
 
 

 

2 ACCEPTED SOLUTIONS
DataNinja777
Super User
Super User

Hi @asif999 ,

 

The issue occurs because you're using ALL() to remove filters from the Live Order Status and Supplier SKU columns, but those columns are part of the visual itself. In Power BI, when a matrix includes columns like Live Order Status, each row inherently carries that filter context even if you try to remove it using ALL(). The visual engine still breaks down the measure row-by-row, so each evaluation sees just one status and counts it as 1. This is why the measure behaves correctly only when the matrix is collapsed to OID, and fails when expanded.

By using ALLEXCEPT(), you’re explicitly saying: “keep only the OID context, wipe everything else,” which aligns perfectly with your goal of calculating the distinct count of statuses per OID regardless of the status or SKU being shown in the matrix. Here's the correct version of the DAX formula:

Multi Status =
CALCULATE(
    DISTINCTCOUNT(Orders[Live Order Status]),
    ALLEXCEPT(Orders, Orders[OID])
)

This measure will always return the correct distinct count of statuses for each OID, ignoring the extra breakdowns in the visual. It works because it respects only the OID-level granularity and clears out all other visual filters, even if they are actively part of the matrix layout.

 

Best regards,

View solution in original post

v-dineshya
Community Support
Community Support

Hi @asif999 ,

Thank you for reaching out to the Microsoft Community Forum.

 

ALL() removes filters only from [Live Order Status] and [Supplier SKU], but leaves all other filters (including the matrix structure and any filters from related tables) untouched.

ALLEXCEPT() Keeps only the filter on OID, and removes all other filters on the Orders table, including those implicitly coming from related matrix rows like [Live Order Status] and [Supplier SKU]. That’s why it behaves as expected because it guarantees that you're working within the context of a specific OID, regardless of any other matrix row values.


Multi Status =
CALCULATE(
DISTINCTCOUNT(Orders[Live Order Status]),
ALLEXCEPT(Orders, Orders[OID])
)

It Ignore all filters except for the OID.

Note: If needed, you can also use REMOVEFILTERS() or KEEPFILTERS() for more granular control:

Multi Status =
CALCULATE(
DISTINCTCOUNT(Orders[Live Order Status]),
REMOVEFILTERS(Orders[Live Order Status], Orders[Supplier SKU])
)
This is functionally close to ALL(), but often behaves better in visuals.

 

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

View solution in original post

2 REPLIES 2
v-dineshya
Community Support
Community Support

Hi @asif999 ,

Thank you for reaching out to the Microsoft Community Forum.

 

ALL() removes filters only from [Live Order Status] and [Supplier SKU], but leaves all other filters (including the matrix structure and any filters from related tables) untouched.

ALLEXCEPT() Keeps only the filter on OID, and removes all other filters on the Orders table, including those implicitly coming from related matrix rows like [Live Order Status] and [Supplier SKU]. That’s why it behaves as expected because it guarantees that you're working within the context of a specific OID, regardless of any other matrix row values.


Multi Status =
CALCULATE(
DISTINCTCOUNT(Orders[Live Order Status]),
ALLEXCEPT(Orders, Orders[OID])
)

It Ignore all filters except for the OID.

Note: If needed, you can also use REMOVEFILTERS() or KEEPFILTERS() for more granular control:

Multi Status =
CALCULATE(
DISTINCTCOUNT(Orders[Live Order Status]),
REMOVEFILTERS(Orders[Live Order Status], Orders[Supplier SKU])
)
This is functionally close to ALL(), but often behaves better in visuals.

 

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

DataNinja777
Super User
Super User

Hi @asif999 ,

 

The issue occurs because you're using ALL() to remove filters from the Live Order Status and Supplier SKU columns, but those columns are part of the visual itself. In Power BI, when a matrix includes columns like Live Order Status, each row inherently carries that filter context even if you try to remove it using ALL(). The visual engine still breaks down the measure row-by-row, so each evaluation sees just one status and counts it as 1. This is why the measure behaves correctly only when the matrix is collapsed to OID, and fails when expanded.

By using ALLEXCEPT(), you’re explicitly saying: “keep only the OID context, wipe everything else,” which aligns perfectly with your goal of calculating the distinct count of statuses per OID regardless of the status or SKU being shown in the matrix. Here's the correct version of the DAX formula:

Multi Status =
CALCULATE(
    DISTINCTCOUNT(Orders[Live Order Status]),
    ALLEXCEPT(Orders, Orders[OID])
)

This measure will always return the correct distinct count of statuses for each OID, ignoring the extra breakdowns in the visual. It works because it respects only the OID-level granularity and clears out all other visual filters, even if they are actively part of the matrix layout.

 

Best regards,

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.