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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Kristian_nho
Helper I
Helper I

Filter out data in a measure without using the FILTER expression

Hello,

 

I have written a measure that distinct counts customers if they have positive Sales data:

 

Customer Count =

CALCULATE(
         DISTINCTCOUNTCustomer[Customer ID] ),
         FILTERSalesTable [NetSales] )
)
 
--NetSales is a measure that simply sums up the Net Sales
This measure gives me the correct information but it tends to exceed the available resources in a matrix visual.
Is there a way to rewrite this measure by not using the FILTER expression in order to improve performance?
 
Thank you in advance.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Kristian_nho , Try like

 

CALCULATE(
Countx(filter( values( Customer[Customer ID] ), [NetSales] > 0 ),[Customer ID]
))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Kristian_nho , Try like

 

CALCULATE(
Countx(filter( values( Customer[Customer ID] ), [NetSales] > 0 ),[Customer ID]
))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Perfect, that worked like a charm. Thank you

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.