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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ElsaLi
Frequent Visitor

Create an average line in a bar chart of average values

Hi there,

 

I wanted to add an average line in my bar chart that is displaying average value of each catagory. However the average line calculates the average of each category average, rather than showing the total average. 

 

This is for the email marketing analysis. The data I have are open rates of each email, and email types.

I want to make a bar chart that displays average open rate of each type, with an average line running through showing the average open rate of all emails.

 

Anyone has a solution to this?

 

Thanks!

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @ElsaLi 

Does this achieve your requirement?

If not, please show more details, like sample data, expected output.

 

Create measures

open rates =
CALCULATE (
    COUNT ( 'Table'[id] ),
    FILTER ( 'Table', 'Table'[status] = "open" )
)
    / CALCULATE ( COUNT ( 'Table'[id] ), ALLEXCEPT ( 'Table', 'Table'[type] ) )

average per type = AVERAGEX(ALLEXCEPT('Table','Table'[type]),[open rates])

Capture26.JPG

 

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

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @ElsaLi 

Does this achieve your requirement?

If not, please show more details, like sample data, expected output.

 

Create measures

open rates =
CALCULATE (
    COUNT ( 'Table'[id] ),
    FILTER ( 'Table', 'Table'[status] = "open" )
)
    / CALCULATE ( COUNT ( 'Table'[id] ), ALLEXCEPT ( 'Table', 'Table'[type] ) )

average per type = AVERAGEX(ALLEXCEPT('Table','Table'[type]),[open rates])

Capture26.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

If you need a straight line across all data. try

 

AVgSales = CALCULATE(AVERAGE(Sales[Sales]),ALLSELECTED())

 

 

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


@amitchandak wrote:

If you need a straight line across all data. try

 

AVgSales = CALCULATE(AVERAGE(Sales[Sales]),ALLSELECTED())

 

 


Thank you. I tried this way. This is a good way to add a line. But it doesn't look as good as the average line in Analytics. Any suggestions?

Can you give an example of what is needed with data?

 

Or you need a weighted Average like

 

Over All Avg = CALCULATE(DIVIDE(sum(Sales[Sales]),count(Sales[item_id])),ALLSELECTED())

 

 

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

Thank you. I tried this way. This is a good way to add a line. But it doesn't look as good as the average line in Analytics. Any suggestions?

 

 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Solution Authors