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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Twitter
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
Twitter
LinkedIn

Thanks! you saved my life

Thanks. I was able to solve.

 

Br,

Shamsu

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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