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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
thiamhuat2026
Helper III
Helper III

Average horizontal Line across the Bar chart

how to have a average horizontal line across the bar chart with the display of the average value above the line on the left side?

thiamhuat2026_0-1778663814177.png

 

1 ACCEPTED SOLUTION

Hey @thiamhuat2026,

To add a dynamic average line to your bar chart, first create this measure:

Avg EDU NoCarpark (%) =
AVERAGEX(
    VALUES('tc_merged_gold'[TOWN_COUNCIL]),
    [EDU_NoCarpark (%)]
)

Then, go to Visualizations > Analytics (search glass icon) > Y-axis constant line > Value (select above measure) and click ok.

Looking at your base measure, SELECTEDVALUE() returns blank the moment more than one distinct value exists in the filter context, silently breaking the average measure. MAX() always returns a single value regardless, making your calculation reliable across all filter and slicer combinations.

EDU_NoCarpark (%) =
DIVIDE(
    COUNT('tc_merged_gold'[CASE_ID]),
    CALCULATE(MAX('tc_merged_gold'[EDU_without_Carpark]))
) * 100

Hope that helps.

Best,

Harshit

View solution in original post

8 REPLIES 8
alish_b
Super User
Super User

Hi @thiamhuat2026 ,

 

You could create a measure that calculates the average value and then pass that measure to the 'Value' in Y-Axis Constant Line using the fx button and in the Field value , select the measure in the 'What field should we base this on?' section.

Hope it helps!

I should say mine is a bit tricky.. those values on each individual bar chart is based on some measure 

EDU_NoCarpark (%) =
DIVIDE(COUNT('tc_merged_gold'[CASE_ID]),SELECTEDVALUE('tc_merged_gold'[EDU_without_Carpark])) * 100, but I cannot find the create another measure of the average of EDU_NoCarpark (%)

Hey @thiamhuat2026,

To add a dynamic average line to your bar chart, first create this measure:

Avg EDU NoCarpark (%) =
AVERAGEX(
    VALUES('tc_merged_gold'[TOWN_COUNCIL]),
    [EDU_NoCarpark (%)]
)

Then, go to Visualizations > Analytics (search glass icon) > Y-axis constant line > Value (select above measure) and click ok.

Looking at your base measure, SELECTEDVALUE() returns blank the moment more than one distinct value exists in the filter context, silently breaking the average measure. MAX() always returns a single value regardless, making your calculation reliable across all filter and slicer combinations.

EDU_NoCarpark (%) =
DIVIDE(
    COUNT('tc_merged_gold'[CASE_ID]),
    CALCULATE(MAX('tc_merged_gold'[EDU_without_Carpark]))
) * 100

Hope that helps.

Best,

Harshit

Below is the result (I took a sample data of Singapore Town Councils from internet):

stoicharsh_0-1778680198397.png

Best,

Harshit

can you share the link of where you get the sample data of Singapore Town Councils from internet?

Hey @thiamhuat2026,

First, I pulled the list of Town councils (19 or so, in count) from Wikipedia (link), then used your bar chart screenshot alongside that list to give ChatGPT and Claude more context. Claude ended up generating a cleaner dataset overall. I can also share the prompt if that's useful!

Hope that helps.

Best,

Harshit

thiamhuat2026_0-1778665476413.png

I am not sure if there is any bug in this, I select what I want, and there is no average or whatsoever, then it does not appear at all.

thiamhuat2026_1-1778665691104.png

My barchart is based on the Measure = EDU_NoCarpark (%), and I want to display the average value (horizontal line) of all those values on the bar chart. Thanks.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.