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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.