cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: ALLEXCEPT is not working as desired in power BI desktop

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!

Connect on Twitter
Connect on LinkedIn

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: ALLEXCEPT is not working as desired in power BI desktop

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!

Connect on Twitter
Connect on LinkedIn

View solution in original post

Highlighted
Post Patron
Post Patron

Re: ALLEXCEPT is not working as desired in power BI desktop

Thanks. I was able to solve.

 

Br,

Shamsu

Highlighted
Frequent Visitor

Re: ALLEXCEPT is not working as desired in power BI desktop

Thanks! you saved my life

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Power BI Desktop August 2020 Update

Power BI Desktop August 2020 Update

We have great updates this month! Click the link for the video with more info.

Top Solution Authors
Top Kudoed Authors