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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
pure_designer
Regular Visitor

Measure using AVERAGEX - total doesn't work with legend in bar chart

I have a measure for a mean monthly average. It seems to work quite well, except for a case where I break a bar chart up by category and the categories don't all have the same number of months. 

pure_designer_0-1703189125481.png

As you can see, the total is the sum of the categories and is not acting like a measure (ignoring the "name") as intended - the graph on the right should have a total mean monthly average of 114.

 

I have a sample file, not sure how to insert it... so the relevant table is:

PERIODuser_idnamevalue
2021-04-011CAT_A20
2021-04-011CAT_B25
2021-04-011CAT_C60
2021-05-011CAT_A20
2021-05-011CAT_B25
2021-05-011CAT_C60
2021-06-011CAT_A20
2021-06-011CAT_B25
2021-06-011CAT_C60
2021-07-011CAT_A20
2021-07-011CAT_B25
2021-07-011CAT_C60
2021-08-011CAT_A20
2021-08-011CAT_B25
2021-08-011CAT_C60
2021-09-011CAT_A20
2021-09-011CAT_B25
2021-09-011CAT_C60
2021-10-011CAT_A20
2021-10-011CAT_B25
2021-10-011CAT_C60
2021-11-011CAT_A20
2021-11-011CAT_B25
2021-11-011CAT_C30
2021-11-013CAT_C30
2021-12-011CAT_A20
2021-12-011CAT_B25
2021-12-011CAT_C30
2021-12-013CAT_C30
2022-01-011CAT_A20
2022-01-011CAT_B25
2022-01-011CAT_C30
2022-01-013CAT_C30
2022-02-011CAT_A20
2022-02-011CAT_B25
2022-02-011CAT_C30
2022-02-013CAT_C30
2022-03-011CAT_A20
2022-03-011CAT_B25
2022-03-011CAT_C30
2022-03-013CAT_C30
2022-03-012CAT_A8
2022-03-012CAT_B16
2022-03-012CAT_C60
2022-03-012CAT_D18

 

and the code is:

Total Value = sum([value])
Mean Monthly = AVERAGEX(VALUES('sample'[PERIOD]), [Total Value])
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Look @Greg_Deckler, the stacked column total is broken!

 

@pure_designer, the total for a stacked column chart is forced to be a simple sum of the height of each component. Unlike with a matrix or a table, there's no simple workaround since the visual assumes your measure is additive even if it shouldn't be, so I wouldn't recommend using a stacked bar chart for non-additive measures.

 

I would definitely support an idea for Microsoft to fix this broken visual so that we can choose whether we want a simple total or a measure-based total, rather than being forced into something with no workaround.

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Look @Greg_Deckler, the stacked column total is broken!

 

@pure_designer, the total for a stacked column chart is forced to be a simple sum of the height of each component. Unlike with a matrix or a table, there's no simple workaround since the visual assumes your measure is additive even if it shouldn't be, so I wouldn't recommend using a stacked bar chart for non-additive measures.

 

I would definitely support an idea for Microsoft to fix this broken visual so that we can choose whether we want a simple total or a measure-based total, rather than being forced into something with no workaround.

Thanks, good to know!

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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