Forum Discussion

mp390988's avatar
mp390988
Post Partisan
1 year ago
Solved

Positioning data labels in Clustered Bar Chart

Hi,   I have 2 labels on my bar chart. One under Value which contains my measure Sales. Then another label under Detail which contains my Rank.      I want to position the Rank on the left...
  • KerKol's avatar
    KerKol
    1 year ago

    Why do you need a company email address?

     

    Another option, is to use a bar chart

     

    create a second measure with a value of (Label = 1) and place this in the x-axis field well,

    under formatting options, 

    select bar overlap

     

    Add value labels to the Label measure and change the default to be the Rank value.

     

    Make the Label measure transparent and change the measure name in the field well to be a space, so that it doesn't show up in legend

     

     

  • v-veshwara-msft's avatar
    v-veshwara-msft
    1 year ago

    Hi mp390988 ,
    We are checking in again to see if the workaround from KerKol was helpful in your scenario.

    Following up on KerKol suggestion I went ahead and tested that workaround and it does achieve your goal of placing:

    • Rank as a data label inside the bar (left-aligned)

    • Sales as a data label outside the bar (right-aligned)

    Final Result:

     

    Steps to Implement it:

    1. Created a dummy measure:

    Label Measure = 1

     

    2. Created a Rank label measure:

    Rank Label = 
    "Rank " & FORMAT(RANKX(ALL('ProductSales'), [Sales Measure], , DESC, DENSE), "00")

     

    3. Create a Sales Measure:

    Sales Measure = SUM('ProductSales'[Sales])

     

    4. Added both measures to the X-axis of a Clustered Bar Chart:

    Sales Measure & Label Measure (used for Rank label)

     

    5. Set Bar Overlap to 100%

     

    6. Assigned data labels:

    Sales Measure --> Position: Outside End; Value: Sales Measure

    Label Measure --> Position: Outside End; Value: Rank Label

     

     

    Output:
    Only one visible bar is shown (Sales), but now:

    -->Rank appears inside left of the bar

    -->Sales remains outside right as expected

     

    This gives the desired two-label effect within Power BI’s native visuals, without using custom visuals like Deneb or Charticulator.

    Thanks again to KerKol  for the creative suggestion - it worked perfectly.

     

    If this helped, please consider marking it as Accepted Solution so other community members can easily find it.