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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
juan_pablo
Advocate III
Advocate III

Simple ALLEXCEPT

Hi,

Why this simple measure in a single table doesn't works?

No matter which option in the slicer of the variable "NOMBRE CORTO" y choose, the measure Prueba2 always shows the same number (16138) which is the total number of rows of the table "Códigos x Parada".

 

Capture.PNG

The documentation for ALLEXCEPT doesn't says anything about different behaviours of ALLEXCEPT depending on the context of the formula.

 

Note: The "|" is just my list separator.

1 ACCEPTED SOLUTION
juan_pablo
Advocate III
Advocate III

Hi, 

Thank you all for your replies but the real reason why it doesn't work is as follow:

 

ALLEXCEPT behaves as described in the documentation only when it's used as a filter argument in CALCULATE, otherwise it would return the table of its first argument without/except the columns in the subsequent arguments.

 

A way to prove this, is look at the ALL function that behaves the same way: A single ALL returns all the table of its argument, and the ALL as a filter argument in CALCULATE removes the filters on all the columns of the table.

 

Two completely different behaviors depending on the context of the function.

 

…DAX and his ambiguities.

View solution in original post

4 REPLIES 4
juan_pablo
Advocate III
Advocate III

Hi, 

Thank you all for your replies but the real reason why it doesn't work is as follow:

 

ALLEXCEPT behaves as described in the documentation only when it's used as a filter argument in CALCULATE, otherwise it would return the table of its first argument without/except the columns in the subsequent arguments.

 

A way to prove this, is look at the ALL function that behaves the same way: A single ALL returns all the table of its argument, and the ALL as a filter argument in CALCULATE removes the filters on all the columns of the table.

 

Two completely different behaviors depending on the context of the function.

 

…DAX and his ambiguities.

Anonymous
Not applicable

It probably does not work because the column you are putting under the function is not filtered DIRECTLY by your filter. Bear in mind that your fact table should have all its column hidden and slicing should be done only through dimensions. Then it'll work but you have to manipulate your dimensions rather than the fact table. ALLEXCEPT takes off DIRECT filters. If there are none, nothing happens.

Best
D

Anonymous
Not applicable

Use simple ALL function to get your desired result.

Calculate(Countrow(table),All(table))

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

az38
Community Champion
Community Champion

Hi @juan_pablo 

it depends on your data model but try to use

Prueba2 = CALCULATE(COUNTROWS('Códigos x Parada'), ALLEXCEPT('Códigos x Parada', 'Códigos x Parada'[NOMBRE CORTO]))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors