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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JulietZhu
Helper IV
Helper IV

Average excluding zero's

I have 15 payments and I need calcualte the average for non-zero payment.

 

Actually there are 10 non-zero payment and average =45895.35/10  =4589.535.

 

But when I used the formula as below. It counts 22 and give me aveage of 2086.15.  Please help me what is wrong with it. Thanks.

 

Avg_NonZero_Payment_Amt = CALCULATE(AVERAGE(Measure]),FILTER(Measure,Measure[Payment_Amt]<>0))

CountRows = Calculate(countrows(Measure), FILTER (Measure,Measure[Payment_Amt]<>0))

 

  Capture.PNG

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi @JulietZhu,

 

Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

 

Best Regards!
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
pxg08680
Resolver III
Resolver III

@JulietZhu

Average = CALCULATE(AVERAGE(Table1[Payment_Amt]),FILTER(Table1,Table1[Payment_Amt] <> 0))

 

Count = CALCULATE(COUNT(Table1[Payment_Amt]),FILTER(Table1,Table1[Payment_Amt] <> 0))

a1.PNG I

I used the same data provided by you and got correctly. Try the above steps again.

MFelix
Super User
Super User

Hi @JulietZhu,

 

Try the following measure:

 

Avg_NonZero_Payment_Amt =
CALCULATE ( AVERAGE ( [Measure] ), SUM ( Measure[Payment_Amt] ) <> 0 )

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix, I tried, but got syntax error.

 

--------------------------------------------------------------------------------------

 

Try the following measure:

 

Avg_NonZero_Payment_Amt =
CALCULATE ( AVERAGE ( [Measure] ), SUM ( Measure[Payment_Amt] ) <> 0 )

Regards,

MFelix

 

Hi @JulietZhu,

 

Did you try the solution of @pxg08680

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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