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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
tomi5
Helper II
Helper II

How to plot average line and upper/lower bounds on visual?

Hi, I have the following sample data and chart. My actual chart is in power bi but this is just for demonstration.

 

cap1.png

 

I have put a line chart in power bi and added the maintenance costs as the y-axis and car age to x-axis and the car id to the legend. It gives me a chart like the one on the right hand side of the above image.

 

I want to add an average line and then an upper limit and lower limit lines (basically average +- 2 * standard deviation).

 

I am not sure how to achieve this in power bi. Because it won't let me use legend and multiple y-axis. Also the maintenance costs exists at a more granular level (for example if car id = A has $62 of maintenance in year 1 that could be made up of multiple rows of maintenance, so already some aggregation is present in the above sample data).

 

Can anyone help please?

 

1 ACCEPTED SOLUTION

Hi @tomi5 

 

Thanks for the reply from Greg_Deckler .

 

If you can consider using Line and stacked column chart visualization, please refer to the following test:

 

Measure:

 

Measure = CALCULATE(AVERAGE('Table'[Maintenance Costs($)]), ALLEXCEPT('Table', 'Table'[Car Age(Years)]))

 

 

Output:

vxuxinyimsft_0-1724320695782.png

 

Best Regards,
Yulia Xu

 

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

3 REPLIES 3
Greg_Deckler
Super User
Super User

@tomi5 Have you looked at using the Analytics pane?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Analytics pane plots a flat average line over the entire dataset rather than calculating the average for each year and then plotting a line based upon that. The latter is what I need so the analytics pane is not suitable.

Hi @tomi5 

 

Thanks for the reply from Greg_Deckler .

 

If you can consider using Line and stacked column chart visualization, please refer to the following test:

 

Measure:

 

Measure = CALCULATE(AVERAGE('Table'[Maintenance Costs($)]), ALLEXCEPT('Table', 'Table'[Car Age(Years)]))

 

 

Output:

vxuxinyimsft_0-1724320695782.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors