Forum Discussion
Issue about average excluding 0's
- 8 years ago
I guess your Payment_Amt may have multiple entries for same date. That's the reason why it will count 22 rows for dates.
In this scenario, you should build a "Total Payment_Amt" measure, then write your CountRows measure like:
CountRows = CALCULATE ( COUNTROWS ( VALUES ( Measure[Date] ) ), FILTER ( VALUES ( Measure[Date] ), [Total Payment_Amt] <> 0 ) )And you need to use Total Payment_Amt divided by CountRows.
Or you can try to replace those 0s with BLANK(). Average() function will ignore empty cells automatically.
Regards,
I guess your Payment_Amt may have multiple entries for same date. That's the reason why it will count 22 rows for dates.
In this scenario, you should build a "Total Payment_Amt" measure, then write your CountRows measure like:
CountRows =
CALCULATE (
COUNTROWS ( VALUES ( Measure[Date] ) ),
FILTER ( VALUES ( Measure[Date] ), [Total Payment_Amt] <> 0 )
)
And you need to use Total Payment_Amt divided by CountRows.
Or you can try to replace those 0s with BLANK(). Average() function will ignore empty cells automatically.
Regards,
- JulietZhu8 years agoHelper IV
When I just use 15 rows as data source and rowcount=10. (1st screenshot) But with my original data source, the rowcount =22 (2nd screenshot). I checked orignal data in sql server and indeed they are 22 rows (3rd screenshot)
Here is my two questions.
1) Does powerbi sum the payment based on each day already? I think it does
2) I do need sum them based on each day, then filter based on sum(payment_Amt)<>0. Which DAX formula should I use? Thanks.