Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

How to calculate sum/count from measure



I have one issue to get count from measure for below scenario.  Appreciate any help . 

Threshold<10<8 >20 >20 
GroupTotal CostNo of itemCount of Item with no price% of item with no priceCount of item with no lead time% of item with no lead timeInclude Indicator


% of item with no price =sum(Table[Blank_Price])/COUNT(Table[Item])

% of item with no lead time=sum(Table[Blank_LT])/COUNT(Table[Item])

Include Indicator=if((Cost <10 || COUNT(Item)<8 || [% of item with no price > 0.195] || [% of item no lead time] > 0.195),0,1)


I try to get Item_Count_Include using below formula but get an error. 

Item_Count_Include = CALCULATE(DISTINCTCOUNT(Table[Item], [Include_Ind] =1)

Warning -> A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

Thank in advanced any help. 

Not applicable

You can't use measures in the logical expressions under CALCULATE ([Include_Ind] =1 is not allowed). You have to use FILTER. In FILTER you can use logical expressions with measures but have to remember about context transition. Filtering arguments to CALCULATE are ALWAYS tables. Please read about CALCULATE here 


Better still, please read this: Filter Arguments in CALCULATE - SQLBI

thank you for the explaination. 

Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors