Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
@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?
Proud to be a Super User!
Paul on Linkedin.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
71 | |
70 | |
38 | |
28 | |
26 |
User | Count |
---|---|
97 | |
88 | |
59 | |
43 | |
40 |