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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
azeenk
Helper I
Helper I

Stacked Column Chart Total Labels Showing Incorrect Sum of Averages in Power BI

Hi Team,

I am facing a critical issue in Power BI related to the Stacked Column Chart total data labels.

I have a Stacked Column Chart where I want to display the sum of average durations of CycleTime (cycletime_nm) on top of the bar.

The bar height should reflect the average, but the label on top of the bar should show the sum of selected cycle times.


The issue is that:

  • When I select a single cycletime_nm, the total label shows correct values.

  • When I multi-select a few cycle times, it sums correctly and displays the accurate total label.

  • But when no filter is applied (i.e., default view, all cycle times selected), the bar total label shows incorrect/inflated values.

1 ACCEPTED SOLUTION

Hi @jaineshp ,

Use this DAX -
 

sm_MinutesCalc_Fixed =
SUMX(
    DISTINCT(CycleTime_IHA_POM_Sliver[cycletime_nm]),
    CALCULATE(AVERAGE(CycleTime_IHA_POM_Sliver[cycletime_minutes]))
)

DDISTINCT ensures one average per unique cycle, regardless of slicer/filter state.

Please find the attached PBIX and Screenshort file for your reference.

Best Regards,
Tejaswi.
Community Support

 

View solution in original post

9 REPLIES 9
rohit1991
Super User
Super User

Hi @azeenk 

 

This is a common issue in Power BI when trying to show the sum of averages on top of a stacked column chart. What happens is that when you use AVERAGE(CycleTime) in the chart, Power BI calculates the average per category correctly, but the total label (on top of the bar) tries to sum all those averages and when no filter is applied, it doesn’t respect the category context, leading to inflated values. To solve this, you can create a DAX measure like this

SumOfAverages =  
SUMX(  
    VALUES('YourTable'[cycletime_nm]),  
    CALCULATE(AVERAGE('YourTable'[CycleTime]))  
) 

This measure calculates the average per cycle time and then adds them up correctly across the selected values  even when no filter is applied. You can use this measure in a card visual or a tooltip to show the correct total value above the bars, while keeping the bar height based on AVERAGE(CycleTime) for each category. 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
jaineshp
Memorable Member
Memorable Member

Hey @azeenk,

I've encountered this exact issue before. The problem occurs because Power BI handles measure aggregation differently when all items are selected vs. when specific items are filtered. When no filter is applied, it's essentially calculating the sum of averages incorrectly due to context transition issues.

Recommended Solution

1. Create New DAX Measure for Total Labels

Replace your existing total label measure with this corrected version:

 

CycleTime_Total_Label =
VAR CycleTimeSelection =
IF(
HASONEFILTER('YourTable'[cycletime_nm]) || HASONEVALUE('YourTable'[cycletime_nm]),
SELECTEDVALUE('YourTable'[cycletime_nm]),
BLANK()
)
VAR FilteredTotal =
IF(
ISBLANK(CycleTimeSelection),
SUMX(
VALUES('YourTable'[cycletime_nm]),
CALCULATE(AVERAGE('YourTable'[CycleDuration]))
),
CALCULATE(AVERAGE('YourTable'[CycleDuration]))
)
RETURN FilteredTotal

2. Alternative Approach (If Above Doesn't Work)

Try this simpler version:

CycleTime_Corrected_Total =
SUMX(
ALLSELECTED('YourTable'[cycletime_nm]),
CALCULATE(
AVERAGE('YourTable'[CycleDuration]),
VALUES('YourTable'[cycletime_nm])
)
)

3. Implementation Steps

  • Remove current total data label measure from your chart
  • Add the new CycleTime_Total_Label measure as data label
  • Ensure data label position is set to "Top of column"
  • Test with single selection, multi-selection, and no filter scenarios

4. Validation Process

Create a matrix visual to verify calculations:

  • Rows: cycletime_nm
  • Values: Your original average measure
  • Add a total row to compare with chart labels

5. Common Issues & Fixes

  • Issue: Labels still showing wrong values Fix: Check if your base measure uses AVERAGE() not SUM()
  • Issue: Performance slowdown Fix: Replace SUMX with SUMMARIZE for large datasets
  • Issue: Blank labels appearing Fix: Add IFERROR() wrapper around the measure

6. Expected Results

After implementation:

  • Single selections: Correct individual average displayed
  • Multiple selections: Accurate sum of selected averages
  • No filter (all selected): Proper total calculation without inflation
  • Chart performance: No significant impact

I've used this approach in similar scenarios and it resolves the aggregation inconsistency you're experiencing.

Fixed? ✓ Mark it • Share it • Help others!


Best Regards,
Jainesh Poojara | Power BI Developer

Heelo @jaineshp , 

 

Thanks for the response.

 

Actually i tried with your solution but still facing same issue.

 

If you know any custom visuals or any other approaches please let me know.

 

thank you in advance

Hi Team,

Thank you for the update but still im facing issue 

DAX Used:

Main DAX:
sum_Avg.Duration DaysHours =

SWITCH(

    SELECTEDVALUE(DayHour[DayHour], "Minutes"),

    "Minutes", [sm_MinutesCalc],

    "Days", [sm_DaysCalc],

    "Hours", [sm_HoursCalc]

)

 

I’ve tried two different DAX approaches for the "Minutes" calculation, but both result in the same issue:

 

sm_MinutesCalc =

SUMX(  

    VALUES(CycleTime_IHA_POM_Sliver[cycletime_nm]),  

    CALCULATE(AVERAGE(CycleTime_IHA_POM_Sliver[cycletime_minutes]))  

)

--------------------------------------------------------------------------------------------

sm_MinutesCalc =

SUMX(

    VALUES(CycleTime_IHA_POM_Sliver[cycletime_nm]),

    AVERAGEX(

        FILTER(

            CycleTime_IHA_POM_Sliver,

            CycleTime_IHA_POM_Sliver[cycletime_nm] = EARLIER(CycleTime_IHA_POM_Sliver[cycletime_nm])

        ),

        CycleTime_IHA_POM_Sliver[MULTIPLYMNTS]

    )

)

 

 

Thank you

 

Hi @jaineshp ,

Use this DAX -
 

sm_MinutesCalc_Fixed =
SUMX(
    DISTINCT(CycleTime_IHA_POM_Sliver[cycletime_nm]),
    CALCULATE(AVERAGE(CycleTime_IHA_POM_Sliver[cycletime_minutes]))
)

DDISTINCT ensures one average per unique cycle, regardless of slicer/filter state.

Please find the attached PBIX and Screenshort file for your reference.

Best Regards,
Tejaswi.
Community Support

 

Hi @azeenk ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

Thank you.

 

Hi @azeenk ,

 

I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.

 

Thank you.

Hi @azeenk ,

 

Thank you @rohit1991 and @jaineshp  for the response provided!

Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.

Thank you for your understanding!

Hey @v-tejrama,

Thank you for the kind recognition - always happy to contribute to our community's success!

Best Regards,
Jainesh Poojara | Power BI Developer

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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