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_Mathur and Greg_Deckler So I had three copies of the measures for which I tested the performance on my Power BI desktop. SUMX() was consistently better performing than COUNTROWS(FILTER() >0) pattern
And removing DISTINCT from SUMMARIZE also had some minor improvements on the run time. Maybe it would change in a huge dataset and the time difference would be considerable.
Greg_Deckler
Community Champion
6 years agoThanks for the information! That does not surprise me, the "X" functions seem to be very performant overall, as I note in my To *Bleep* with RANKX Quick Measure, https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/td-p/1042520