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
shamsuddeenvp
Post Patron
Post Patron

ALLEXCEPT is not working as desired in power BI desktop

Dear Team,

 

I am trying to calculate count rows, that should fetch all record count except the filter in two columns. However this seems to be not working on power BI desktop.

 

I am getting same value though I change in the values in the columns mentioned in the all except clause).

 

Arr_Movements_no_filter:=COUNTROWS(ALLEXCEPT('Arrivals',Arrivals[CANCEL_CODE])).

 

I selected cancel code value, however no change in the value.

 

Please help.

 

Thanks!
Shamsuddeen

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi Shamsuddeen,

 

When you use ALLEXCEPT as in your example (i.e. not as a top-level filter argument for CALCULATE), it returns an unfiltered table containing all distinct rows of the table specified in the first argument, with the columns in the 2nd arguments onwards excluded from the table.

 

In your case, ALLEXCEPT('Arrivals',Arrivals[CANCEL_CODE]) returns an unfiltered 'Arrivals' table with the [CANCEL_CODE] column removed (reduced to distinct rows). The table returned will be the same regardless of any filters on [CANCEL_CODE].

 

Do you want a measure to return the number of rows in 'Arrivals' with all filters removed except for [CANCEL_CODE]? Then you could use this measure:

 

 

Arr_Movements_no_filter :=
CALCULATE (
    COUNTROWS ( 'Arrivals' ),
    ALLEXCEPT ( 'Arrivals', Arrivals[CANCEL_CODE] )
)

 

When ALLEXCEPT is used as a top-level filter argument for CALCULATE, it doesn't return a table as such but has the effect of removing all filters except for the columns specified.

 

Is that what you were trying to do?

 

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
OwenAuger
Super User
Super User

Hi Shamsuddeen,

 

When you use ALLEXCEPT as in your example (i.e. not as a top-level filter argument for CALCULATE), it returns an unfiltered table containing all distinct rows of the table specified in the first argument, with the columns in the 2nd arguments onwards excluded from the table.

 

In your case, ALLEXCEPT('Arrivals',Arrivals[CANCEL_CODE]) returns an unfiltered 'Arrivals' table with the [CANCEL_CODE] column removed (reduced to distinct rows). The table returned will be the same regardless of any filters on [CANCEL_CODE].

 

Do you want a measure to return the number of rows in 'Arrivals' with all filters removed except for [CANCEL_CODE]? Then you could use this measure:

 

 

Arr_Movements_no_filter :=
CALCULATE (
    COUNTROWS ( 'Arrivals' ),
    ALLEXCEPT ( 'Arrivals', Arrivals[CANCEL_CODE] )
)

 

When ALLEXCEPT is used as a top-level filter argument for CALCULATE, it doesn't return a table as such but has the effect of removing all filters except for the columns specified.

 

Is that what you were trying to do?

 

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thanks! you saved my life

Thanks. I was able to solve.

 

Br,

Shamsu

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.