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

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

Reply
admin_xlsior
Post Prodigy
Post 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('Order analysis', ('Order analysis'[WIP open] <= LASTDATE('WIP Date'[Date])
&& 'Order analysis analysis'[WIP closed] >= FIRSTDATE('WIP Date'[Date]))))

 

Which apperantly taking very long processing time and sometime out of memory.

 

Thanks,

 

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

 
Many factors may affect the performance of power Bi, such as large data volume, data model and complex DAX expression.
You can refer to the following article to optimize the performance of power bi.
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

'Order analysis'[order Id] is the primary key then you can use count or countrows. 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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,

 

 

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.