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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
hideakisuzuki01
Helper II
Helper II

ALL function in virtual table is not removing duplicates

Hi,

I cannot seem to figure out this so I need help.

I have this simple table.

Order NumberQtyUnitPriceSales
A18080
B18080
C3200600
D3200600
E54002000

 

When I create a calculated table with the below DAX code, 

 

Table1 = FILTER(
ALL(
'Sales'[Qty],
'Sales'[UnitPrice]
),
'Sales'[Qty]*'Sales'[UnitPrice] > 100)
 
I get this simple table.
hideakisuzuki01_0-1651280284453.png

 

But if I create a measure with the DAX code (which includes the above DAX code), 

 

TransactionsHigherThan$100  =
CALCULATE( SUM('Sales'[SalesAmount]),
FILTER(ALL(
'Sales'[Qty],
'Sales'[UnitPrice] ),
'Sales'[Qty]*'Sales'[UnitPrice] >= 100)
)
 
If I show the value of the measure using Card or table, then the total I get is $3200, but shouldnt that be $2600 ?
because the ALL function is supposed to remove the duplicates (order number C and D and the duplicates do get removed in the above calculated table).
 
Please let me know if you need clarification.
1 ACCEPTED SOLUTION
hnguy71
Super User
Super User

@hideakisuzuki01 , hehehe, the ALL function kinda doesn't work like that.

 

Try this as a measure instead:

@Sales = 
VAR _Expression = FILTER(SUMMARIZECOLUMNS(Sales[Qty], Sales[UnitPrice]), Sales[Qty] * Sales[UnitPrice] >= 100) 

RETURN

SUMX(_Expression, [Qty] * [UnitPrice])


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

The first ALL() returns a physical table, as you see; whereas the second ALL() is embedded in FILTER() and FILTER() returns a filter for CALCULATE(). That's to say, any rows pass through the filter will be used for calculation.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

hnguy71
Super User
Super User

@hideakisuzuki01 , hehehe, the ALL function kinda doesn't work like that.

 

Try this as a measure instead:

@Sales = 
VAR _Expression = FILTER(SUMMARIZECOLUMNS(Sales[Qty], Sales[UnitPrice]), Sales[Qty] * Sales[UnitPrice] >= 100) 

RETURN

SUMX(_Expression, [Qty] * [UnitPrice])


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.