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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
prill22ta
Frequent Visitor

Using VALUES + ALL instead of just ALL. Resolution included - Need to know WHY it works

Hi there, 

I recently ran into the following issue. My team has since resolved it (included) but we don't know 'why' it is the resolution.

The ask: Calculate a Distinct Count of Values where the Primary Key  IN  a list of PK's defined by a subquery. 
The strange thing is, that when we ran the subquery through DAX Studio by itself, it returned the expected results. 
Thank you for taking a look!

The DAX that WORKED: 

VAR _subq =

CALCULATETABLE (
    VALUES(  table[field] ),
    ALLtable ),
    table[field2] = "Yes"
)
VAR _count = CALCULATE (
    DISTINCTCOUNTtable[field] ),
 table[field] IN _subq)
RETURN
_count

 
The DAX that DID NOT WORK: 

VAR _subq =

CALCULATETABLE (
    ALL(  table[field] ),
    table[field2] = "Yes"
)
VAR _count = CALCULATE (
    DISTINCTCOUNTtable[field] ),
 table[field] IN _subq)
RETURN
_count
1 ACCEPTED SOLUTION
v-jialluo-msft
Community Support
Community Support

Hi @prill22ta ,

 

Using a single column argument, ALL returns all the unique values of the column.

CALCULATETABLE (
    ALL(  table[field] ),
    table[field2] = "Yes"
)

So this statement returns the unique value of the table[filed] column, and the following table[filed2]="Yes" does not play a filtering role for the previous statement, because the ALL function ignores all filters

vjialluomsft_0-1668407473661.png

 

ALL DAX Guide

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jialluo-msft
Community Support
Community Support

Hi @prill22ta ,

 

Using a single column argument, ALL returns all the unique values of the column.

CALCULATETABLE (
    ALL(  table[field] ),
    table[field2] = "Yes"
)

So this statement returns the unique value of the table[filed] column, and the following table[filed2]="Yes" does not play a filtering role for the previous statement, because the ALL function ignores all filters

vjialluomsft_0-1668407473661.png

 

ALL DAX Guide

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

prill22ta
Frequent Visitor

Both versions are a measure.

FreemanZ
Community Champion
Community Champion

For the first dax code, is it a measure? what filter context does it have?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.