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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Average of Percent

Hello Community  -  I am trying to get an average at the bottom total to make sense.   In other words, if one were to add up the percentages in a column, and divide by the number of rows, it would be correct.  

 

.04

.09

.03

 

In simple terms, these three rows would average to .0533     And to use that logic below, the sum of the average 898.2977 / 112 would equal 8.0205  but I get a different result.     Any ideas?   I do need the formula to account for filters that may be added.  

 

Average Discount =
VAR AvgDiscount =
AVERAGEX(
FILTER(
'AllOpps-Products',
'AllOpps-Products'[Discount] = BLANK() || 'AllOpps-Products'[Discount] >=0
),
'AllOpps-Products'[Discount]
)
RETURN
IF(
HASONEVALUE( 'Date Table'[Month] ),
AvgDiscount,
(
AVERAGEX(
VALUES( 'Date Table'[Month] ),
AvgDiscount
)
)
)

 

 

texmexdragon_0-1618966422753.png

 

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous,

It should help us clarify your scenario and test to coding formula if you please share some dummy data with a similar data structure and expected results.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@Anonymous , Try like

 

Average Discount =
VAR AvgDiscount =
Sumx(
FILTER(
'AllOpps-Products',
'AllOpps-Products'[Discount] = BLANK() || 'AllOpps-Products'[Discount] >=0
),
'AllOpps-Products'[Discount]
)
RETURN
divide
(
Countx(
VALUES( 'Date Table'[Month] ),
AvgDiscount
) , AvgDiscount
)

 

 

or

 

 

Average Discount =
VAR AvgDiscount =
Averagex(
FILTER(
'AllOpps-Products',
'AllOpps-Products'[Discount] = BLANK() || 'AllOpps-Products'[Discount] >=0
),
'AllOpps-Products'[Discount]
)
RETURN
divide
(
Countx(
VALUES( 'Date Table'[Month] ),
AvgDiscount
) , AvgDiscount
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak     Something is still very weird and I can't understand what Power Bi is doing.   Your formula is included below, along with another one and then also just the average using the built in Power Bi one to average that discount column.   All return the same results for these three rows...and it matches in Excel.  

 

However.....if I add just ONE additional row...things get weird.   In the second visual below you can see I have added one row by adding "open" to the filter.    If you add those 4 rows with a calculator (or Excel) and divide by 4 you will get 11.75% which is the correct number because I want to include all 4 rows.   The 0% needs to be counted  (not ignored).     I have no idea why Power Bi is saying  12.591%

 

texmexdragon_0-1619005635104.png


texmexdragon_1-1619005794261.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors