Forum Discussion

Kristian_nho's avatar
Kristian_nho
Icon for Helper I rankHelper I
4 years ago
Solved

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(
         DISTINCTCOUNT( Customer[Customer ID] ),
         FILTER( SalesTable , [NetSales] > 0 )
)
 
--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.

2 Replies

  • Kristian_nho , Try like

     

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