Forum Discussion
admin_xlsior
6 years agoPost Prodigy
Distinct count VS Countrows(values(....))
Hi guys, Can we replace DistinctCount() to CountRows(Values(..)) ? Which one is quicker ? I have a measure like this : OrderCount = CALCULATE(DISTINCTCOUNT('Order analysis'[order Id]), FILTER(...
amitchandak
6 years agoSuper User
'Order analysis'[order Id] is the primary key then you can use count or countrows.
- admin_xlsior6 years agoPost Prodigy
Hi guys,
so currently I changed my measure to be like this :
OrderCount =
VAR TmpOrder = ADDCOLUMNS(
SUMMARIZE(
FILTER('Order analysis', ('Order analysis'[WIP open] <= LASTDATE('WIP Date'[Date])
&& 'Order analysis'[WIP closed] >= FIRSTDATE('WIP Date'[Date]))
),
'Order analysis'[Order Id])
,"tmp",1
)RETURN SUMX(TmpOrder, [tmp])
And it looks faster. Is it correct to use that ?
Thanks,