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.
karun_r
Microsoft Employee
6 years agoAshish_MathurWhy would I want to do a sum of [Sales] measure ? I am just trying to get a count of number of orders for each day where sales > 0. I shouldn't have to do a sum on Sales , right ?
Ashish_Mathur
Super User
6 years agoHi,
Does this work?
=COUNTROWS(FILTER(SUMMARIZE(Sales,Sales[Order Number],Calendar[Date],"Sale",[Total Sales]),[Sale]>0))
- karun_r6 years ago
Microsoft Employee
Ashish_Mathur Yes, that is matching with my current metric results, I have two other versions of the same metric, I am going to test the performance of each metric and get back