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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sadiahsapiee
Helper I
Helper I

How to calculate sum/count from measure

Hi,

 

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
A207114%229%0
B1510660%110%0
C311600%213%1
D3117212%00%1
E2017529%00%0
F810110%00%0

 

% 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. 

2 REPLIES 2
Anonymous
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 https://dax.guide/calculate 

 

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

thank you for the explaination. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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