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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mlm198
Regular Visitor

Average in stacked bar chart

Hi

 

I have a clustered column chart which shows a quantity of different items in the stack against a month where the month is filtered with a slicer. I have added an average line on the 'add further analyses panel'. This gives the correct answer of 20. However I would prefer it to be a stacked column chart with an average line. If I do that and add a constant line set to "sumamarization" equal to "average" the quantity is gives the incorrect number of 3.8. 

What am I doing wrong?

Thanks in advance.

Matthew

1 ACCEPTED SOLUTION

Hi, @mlm198 

@amitchandak , thanks for your concern about this case. I tried to create a sample data as follows:

vjianpengmsft_0-1711674421175.png

I created a line and stacked column chart visual as shown in the following image:

vjianpengmsft_1-1711674556624.png

I used the following DAX to find the average of Qty:

CALCULATE ( AVERAGE ( tblQty[Qty] ), ALL ( 'tblQty' ) )

 The results are shown in the image below:

vjianpengmsft_2-1711674670863.png

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng 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

3 REPLIES 3
amitchandak
Super User
Super User

@mlm198 , Use a measure in constant line

 

Averagex(Values(Table[X Axis Column]), [measure])

 

or

 

Averagex(Summarize(Table, Table[X Axis Column], Table[Legend COlumn], "_1", [measure]), [_1])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks for your help.

Sorry I need further help - very much new to Power BI.

So I have entered the following:

ave = averagex(VALUES(tblQtyDate[Date].[Month],tblQty[Qty]))

So the X-axis is tblQtyDate[Date].[Month]

Y axis is tblQtyShipped[Qty Shipped]

What am I doing wrong?

Best Wishes

Matthew

Hi, @mlm198 

@amitchandak , thanks for your concern about this case. I tried to create a sample data as follows:

vjianpengmsft_0-1711674421175.png

I created a line and stacked column chart visual as shown in the following image:

vjianpengmsft_1-1711674556624.png

I used the following DAX to find the average of Qty:

CALCULATE ( AVERAGE ( tblQty[Qty] ), ALL ( 'tblQty' ) )

 The results are shown in the image below:

vjianpengmsft_2-1711674670863.png

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.