The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
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.
Solved! Go to 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
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.
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.
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
Try this simpler version:
CycleTime_Corrected_Total =
SUMX(
ALLSELECTED('YourTable'[cycletime_nm]),
CALCULATE(
AVERAGE('YourTable'[CycleDuration]),
VALUES('YourTable'[cycletime_nm])
)
)
Create a matrix visual to verify calculations:
After implementation:
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
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
28 | |
17 | |
11 | |
7 | |
5 |