Forum Discussion

fsfs's avatar
fsfs
Icon for Helper I rankHelper I
5 years ago
Solved

adding data labels to 100% stacked bar chart

hi

 

I would like the bar to not only show % of total, but also the name of category next to it (very similar to detail labels in pie chart)

 

how can I do that?

 

 

  • Hi, fsfs ;

    You could add custom power bi visual as follows:

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

5 Replies

  • fsfs , You need to use a measure that % percent. If you want to show percent

     

    Assume you have measure

    Axis is using col1

     

    then use measure

    divide([measure], calculate([measure], filter(allselected(Table), Table[Col1] = max(Table[Col1]))))

     

    if need use a stacked line and show measure

    calculate([measure], filter(allselected(Table), Table[Col1] = max(Table[Col1])))

     

    on that and show labels and change line color same as background color

     

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, fsfs ;

    According your description, you could create a measure to calculate the percentage of every category. I create a simple example and create a measure as follows:

    sales%1 = CALCULATE(SUM([Sales EUR]),ALLEXCEPT('Table','Table'[Year],'Table'[category]))/CALCULATE(SUM([Sales EUR]),ALLEXCEPT('Table','Table'[Year]))

    then change the visualization's setting.

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • I'll try to rephrase it

    I have it like this:

    *cat A   *cat B

    _______

    |         |

    55%|

    |______|

    |         |

    45%|

    |______|

     

    I want it like this   

     

    _______

    cat A|

    55%|

    |______|

    | cat B|

    45%|

    |______|

     

    or like this

     

    _______

    |         |

    55%| --- cat A

    |______|

    |         |

    45%| --- cat B

    |______|

      

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, fsfs ;

    You could add custom power bi visual as follows:

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, fsfs  ;

    Is the above answer helpful to you? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.