Forum Discussion
JulietZhu
8 years agoHelper IV
Issue about average excluding 0's
I have 15 pyaments and 10 are non-zero payments. I need calculate average for non-zero payments Actul average = 45895.35/10 = 4589.535. But when I used DAX formula as below. It counts 22 ro...
- 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,
Greg_Deckler
8 years agoCommunity Champion
You can't really do it that way. Your measure is 0 in the context of the row of your table visualization but not in just any context. You will need to probably do a SUMMARIZE and then take the average. See this design pattern here:
https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149