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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
MuthalibAbdul
Helper II
Helper II

Percentage change when having legend in a stacked bar graph

MuthalibAbdul_1-1769197337159.png

MuthalibAbdul_2-1769197373055.png

 

The first visual is what Im getting while the second is what Im trying to achive plus the stackkked categories. 

The first visual is a stacked bar graph where the locations are denoted by different color. Im trying to do a week over with percentage change. This works fine when I do not add a column or field in the legend section. However, once I add a legend, the percentage difference is calculated by every location which is not what I want. I still want the bars to show different colors for each location, but want the percentage diff shown on the top. I have pasted all the 3 measures Im using to get the result. But somehow want the measures to show up on top of the bar while also exclude the Location column

PW Encounters =
VAR MaxDate = MAX('Calendar'[Date])
// FIX: Use WEEKDAY(..., 1) for Sunday start
VAR WeekStart = MaxDate - WEEKDAY(MaxDate, 1) + 1  // Changed from default to 1
VAR PreviousWeekStart = WeekStart - 7
VAR PreviousWeekEnd = PreviousWeekStart + 6
RETURN
CALCULATE(
    [Total Encounters],
    FILTER(
        ALL('Calendar'),
        'Calendar'[Date] >= PreviousWeekStart &&
        'Calendar'[Date] <= PreviousWeekEnd
    )
)

WeekDiff =
VAR PrevWeek = [PW Encounters]
VAR CurrWeek = [Total Encounters]
RETURN
IF(
    ISBLANK(PrevWeek),
    BLANK(),
    CurrWeek - PrevWeek
)
WoW%withsigns =
VAR _WoW =
DIVIDE(
    [WeekDiff], [PW Encounters] )
RETURN
FORMAT(
    _WoW,
 "▲ 0%;▼ 0%")



1 ACCEPTED SOLUTION

Hi @MuthalibAbdul 

 

There’s currently no way to use a custom field for the total label. Another approach would’ve been to use a line chart and label the lines instead—but even though line charts appear to support custom data labels, it doesn’t actually work in practice (switching to a different measure doesn’t change anything). Please vote for this issue: https://community.fabric.microsoft.com/t5/Issues/Combo-chart-custom-data-label-for-line-chart-not-ma...

 

 

So the workaround is to identify which series will always sit on top, then enable data labels only for that series. On top of that, a separate measure is needed to calculate the total across all series.

 

I used these measures for the image below:

Revenue All Geos = 
CALCULATE ( [Total Revenue], ALL ( Geo ) )

Revenue MOM = 
VAR _prev =
    CALCULATE ( [Revenue All Geos], PREVIOUSMONTH ( Dates[Date] ) )
VAR _diff = [Revenue All Geos] - _prev
RETURN
    DIVIDE ( _diff, _prev )

danextian_0-1769327629987.png

Would have been better if there was an option to add the data label outside the series but it also isn't available. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
v-veshwara-msft
Community Support
Community Support

Hi @MuthalibAbdul ,

We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @MuthalibAbdul ,


Thanks for reaching out to Microsoft Fabric Community.

Just wanted to check if the responses shared were helpful. If further assistance is needed, please reach out.

 

Also as noted by @d_m_LNK, it would be useful to confirm where the measure is applied on the visual, as data label behavior can depend on how the measure is added and formatted.

 

Additionally if the scenario discussed by @danextian matches your requirement, please consider upvoting the issues link to help bring more visibility to this enhancement request.

 

If you need any further clarification, please let us know.

Thank you.

MuthalibAbdul
Helper II
Helper II

This actually worked partially. However, how do I add the percentage change on top of the bar and not for each category in the bar? Thanks

 

MuthalibAbdul_0-1769212268977.png

 

Hi @MuthalibAbdul 

 

There’s currently no way to use a custom field for the total label. Another approach would’ve been to use a line chart and label the lines instead—but even though line charts appear to support custom data labels, it doesn’t actually work in practice (switching to a different measure doesn’t change anything). Please vote for this issue: https://community.fabric.microsoft.com/t5/Issues/Combo-chart-custom-data-label-for-line-chart-not-ma...

 

 

So the workaround is to identify which series will always sit on top, then enable data labels only for that series. On top of that, a separate measure is needed to calculate the total across all series.

 

I used these measures for the image below:

Revenue All Geos = 
CALCULATE ( [Total Revenue], ALL ( Geo ) )

Revenue MOM = 
VAR _prev =
    CALCULATE ( [Revenue All Geos], PREVIOUSMONTH ( Dates[Date] ) )
VAR _diff = [Revenue All Geos] - _prev
RETURN
    DIVIDE ( _diff, _prev )

danextian_0-1769327629987.png

Would have been better if there was an option to add the data label outside the series but it also isn't available. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Where do you have that measure applied to the visual?  It's most likely a formatting issue but can't tell where the measure is added.

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃
d_m_LNK
Super User
Super User

The last measure you specified is going to follow the filter context so that's why each location is evaluated separately.  You could try this for your measure:

WoW%withsigns =
VAR _WoW =
CALCULATE(
DIVIDE(
    [WeekDiff][PW Encounters] ),
ALLSELECTED(Locations[Locations])
)
RETURN
FORMAT(
    _WoW,
 "▲ 0%;▼ 0%")
-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.