cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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?

Matthew

1 ACCEPTED SOLUTION
Community Support

Hi, @mlm198

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

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:

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

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.

3 REPLIES 3
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])

Regular Visitor

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

Community Support

Hi, @mlm198

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

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:

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

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.

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors