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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Using DAX to Calculate Number of Customers Who Have Met Threshold

I have a model that includes a fact table that shows individual order data and filter tables for our Item Master and Customer Master, connected with a one-to-many relationship to the fact table. The model also includes a table that holds designated thresholds for a couple of product types and customer segments that is not connected to any of the other tables.

 

I have a DAX query that calculates the number of customers who have sold a specific number of products and it seems to calculate correctly. However, it is slower than I would like, typically taking around at least 8-12 seconds for the query alone and sometimes throwing a memory error depending on selected filters.

 

This query starts by totaling up the number of customers without blank values:

 

Total Customers = 
    CALCULATE(
        SUM( 'Customer Master'[Customers] ),
        FILTER(
            'Customer Master',
            NOT( ISBLANK( [Total Pieces] ) )
        )
   )

 

 

I then calculate the product thresholds using TREATAS to connect to the master tables:

 

Total Threshold = 
    CALCULATE(
        SUM( 'Thresholds'[Threshold] ),
        TREATAS( VALUES( 'Customer Master'[Segment] ), 'Thresholds'[Segment] ),
        TREATAS( VALUES( 'Item Master'[Product Family]), 'Thresholds'[Product] )
    )

 

 

Finally, the query in question calculates how many customers have reached or exceeded the thresholds:

 

Customers Meeting Threshold = 
        CALCULATE(
            [Total Customers],
            FILTER( 
                'Customer Master',
                [Total Units] >= [Total Threshold]
            )
        )

 

 

Does anybody have a recommendation for helping the efficiency of this query?

1 REPLY 1
PaulDBrown
Community Champion
Community Champion

@Anonymous 

Can you please include a sample/ dummy data of the tables involved to recreate the model and measures?

I take it you are trying to filter by the threshold table, correct?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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