
Answer-first summary for fast verification
Answer: Yes
The solution improves performance by replacing CALCULATE(COUNTROWS('Order Item')) > 0 with NOT ISEMPTY(CALCULATETABLE('Order Item')). The original approach counts all rows in the 'Order Item' table for each product color, which is computationally expensive, especially with large datasets. The new approach checks only for the existence of at least one row (similar to EXISTS in SQL), stopping as soon as it finds one, thus reducing resource usage and execution time. Community discussion strongly supports this (86% chose 'Yes'), with upvoted comments highlighting the efficiency gain from avoiding full row counts and the analogy to SQL's EXISTS behavior.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You have a Fabric tenant containing a semantic model named Model1. You find that the following query executes slowly against Model1.
EVALUATE
SUMMARIZECOLUMNS (
'Product'[Color],
FILTER (
VALUES ( 'Product'[Color] ),
CALCULATE ( COUNTROWS ( 'Order Item' ) ) > 0
)
)
EVALUATE
SUMMARIZECOLUMNS (
'Product'[Color],
FILTER (
VALUES ( 'Product'[Color] ),
CALCULATE ( COUNTROWS ( 'Order Item' ) ) > 0
)
)
You need to reduce the query execution time.
Solution: Replace line 4 with the following code:
NOT ISEMPTY ( CALCULATETABLE ( 'Order Item' ) )
Does this solution meet the goal?

A
Yes
B
No