Forum Discussion
gardas_swathi
3 years agoMicrosoft Employee
Performance Issue with COUNTROWS Summarize
Hi, I need somehelp in rewriting my DAX Measure. Below Measure is taking atleast 2-3 mins to get the data from the tables. [Demand],[MonthlySupply] &[NetAvailSupplyDemand] are existing measures...
tamerj1
3 years agoCommunity Champion
Hi gardas_swathi
Please try
Product Coverage :=
VAR RowCount =
COUNTROWS (
FILTER (
SUMMARIZE ( 'Demand Table', 'Product'[ID] ),
VAR Demand = [Demand]
VAR MonthlySupply = [MonthlySupply]
VAR NetAvailSupplyDemand = [NetAvailSupplyDemand]
RETURN
IF (
(
(
ISBLANK ( Demand )
|| Demand <= 0
)
&& (
ISBLANK ( MonthlySupply )
|| MonthlySupply <= 0
)
&& (
ISBLANK ( NetAvailSupplyDemand )
|| NetAvailSupplyDemand <= 0
)
)
|| (
(
ISBLANK ( Demand )
|| Demand <= 0
)
&& MonthlySupply > 0
),
-1,
IF (
(
NOT ISBLANK ( Demand )
|| Demand > 0
)
&& (
ISBLANK ( MonthlySupply )
|| MonthlySupply = 0
),
-1,
NetAvailSupplyDemand
)
) >= 0
)
)
RETURN
IF ( ISBLANK ( RowCount ) && [NetAvailSupplyDemand] <= 0, 0, RowCount )
gardas_swathi
3 years agoMicrosoft Employee
Hi tamerj1 ,
Thanks for your response. This solution has not reduced the performance significantly. Its taking 30 seconds less than it used to before. However i am seeing this error in the last line. Is it because we are using NetAvailSupplyDemand Variable outside the context of creation?