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
singarfield
Helper I
Helper I

Bar chart split by age and total

Hi everyone, 

At the moment I have this bar chart, but I would like to create an additional column where I get all the responses in a stacked bar, aggregated by age. How would I go about doing this?

age query.png

Thank you

Sara

2 ACCEPTED SOLUTIONS
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@singarfield,

You can create a measure using similar DAX as below. Then use Line and stacked column chart to dispaly the data, or drag the measure to tooltips of your current bar chart.

Measure = CALCULATE([yourmeasure],ALLEXCEPT(Table,Table[Age]))

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

@singarfield,

Right-click your table, and select "New Measure", then apply above formula.
1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

5 REPLIES 5
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@singarfield,

You can create a measure using similar DAX as below. Then use Line and stacked column chart to dispaly the data, or drag the measure to tooltips of your current bar chart.

Measure = CALCULATE([yourmeasure],ALLEXCEPT(Table,Table[Age]))

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, 

Im still very new to power BI, so this doesn't really tell me where I would go to create this value. Could you give more of a step-by-step answer, please?

Thank you

Sara

@singarfield,

Right-click your table, and select "New Measure", then apply above formula.
1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you!

Sara

AkhilAshok
Solution Sage
Solution Sage

I don't think you have an option to add Grand Total in a bar chart. A workaround would be the following:

 

1. Create a new dimension table Age:

Age New = 
UNION (ROW("Age", "Total"), VALUES(Table[Age]))

2. Create a relationship between the Age column in this new dimension table and your fact table.

 

3. Create a new measure:

Measure New =
SWITCH (
    SELECTEDVALUE ( 'Age New'[Age] ),
    "Total", CALCULATE ( [Measure], ALL ('Age New'[Age]) ),
    [Measure]
)

4. Use this Measure New and Age New dimension in your chart.

 

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! Prices go up Feb. 11th.

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.