Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
I need help in attempt transform excel model into power bi. Created the calc measure to count. The trouble lie in seeking the average if non zero of this calc measure. Got an error message stating function AVERAGEX cannot work with values of type Boolean. Maybe I'm overthinking something. Thank you.
Excel Model
CountIF=COUNTIF(B5:B39,"<>0")
AverageIF=AVERAGEIF(B5:B39,"<>0",B5:B39)
PowerBi Model
Ct _Measure = CALCULATE(COUNT(Data[Trn Units]),FILTER('Data',Data[Claim]="Y" && Data[Name]="GeneralName"))
Avg _Measure = CALCULATE(AVERAGEX(VALUES('Data'[Acct]),([Ct _Measure]<>0 || [Ct _Measure]<>BLANK())))
Solved! Go to Solution.
Hi @Tevon713
You are getting that error because you are trying to compare a measure against 0 and that comparison returns a boolean value which cannot be included in the expression.
[Ct _Measure] <> 0 || [Ct _Measure] <> BLANK ()
Try the following
Avg _Measure =
AVERAGEX ( VALUES ( 'Data'[Acct] ), IF ( [Ct _Measure] <> 0, [Ct _Measure] ) )
CALCULATE is not necessary as it is implicitly applied. AVERAGEX ignores blanks.
Hi @Tevon713
You are getting that error because you are trying to compare a measure against 0 and that comparison returns a boolean value which cannot be included in the expression.
[Ct _Measure] <> 0 || [Ct _Measure] <> BLANK ()
Try the following
Avg _Measure =
AVERAGEX ( VALUES ( 'Data'[Acct] ), IF ( [Ct _Measure] <> 0, [Ct _Measure] ) )
CALCULATE is not necessary as it is implicitly applied. AVERAGEX ignores blanks.
Thank you all especially @danextian your solution make the most sense as currently set up in my data flow.
Hi @danextian.
If I have another measure similar to Ct _Measure just it Sum_Pmt and if I wanted to distinct count those acct whose Sum_Pmt <> 0 or blank. Error message "function placeholder has been used in a true/false in a table filter expression". What am I doing wrong here?
Sum_Pmt= CALCULATE(COUNT(Data[Payments]),FILTER('Data',Data[Claim]="Y" && Data[Name]="GeneralName"))
Ct _Acct =CALCULATE(DISTINCTCOUNT(Data[Acct]),
VAR _maxValue = [Sum_Pmt]
RETURN _maxValue <>0
)
Hi,
Try this measure
Measure = countrows(filter(values(Data[Acct]),[sum_pmt]<>0))
You are welcome.
Avg_Measure =
AVERAGEX(
VALUES(Data[Acct]),
VAR x = CALCULATE(COUNT(Data[Trn Units]), FILTER(Data, Data[Claim] = "Y" && Data[Name] = "GeneralName"))
RETURN IF(x <> 0, x)
)
@Tevon713 try this:
Avg _Measure = AVERAGEX(VALUES('Data'[Acct]),[Ct _Measure])
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |