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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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