Forum Discussion
karun_r
Microsoft Employee
6 years agoDISTINCT over SUMMARIZE
I have a measure that follows the pattern as mentioned below Test Adds =
CALCULATE (
SUMX (
DISTINCT ( SUMMARIZE ( Sales, Sales[Order Date], Sales[Order Number] ) ),
IF ( Sal...
- 6 years agoI do not see the need for DISTINCT, SUMMARIZE already makes things distinct.
Maybe, but don't know your data to be sure. Should just be able to use COUNTROWS and FILTER the table returned from SUMMARIZE but not sure that is more efficient or not.
amitchandak
Super User
6 years agoI doubt you need to summarize there. Also, the formula should one of the two as per need
Test Adds =
CALCULATE (
SUMX (
SUMMARIZE ( Sales, Sales[Order Date], Sales[Order Number],"_1",sumx ( Sales,if(Sales[Sales Amount] > 0, 1, 0 ) )),
[_1]
)
)
Test Adds =
CALCULATE (
SUMX (
SUMMARIZE ( Sales, Sales[Order Date], Sales[Order Number],"_1",sum ( Sales[Sales Amount]) ),
if([_1] > 0, 1, 0 )
)
)
karun_r
Microsoft Employee
6 years agoamitchandak Would that have an performance improvement over my current metric definition ? If so, can you please help me understand how it would improve things ?