Forum Discussion

CTH2022's avatar
CTH2022
Frequent Visitor
4 years ago
Solved

Label on stacked column chart

Have the following data set.

 

Apple 10

Orange 20

Mango ALL

 

How to show ALL as label on the chart?

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi CTH2022 ,

    I updated the sample pbix file(see attachment), please check whether that is what you want. You can update the formula of Measure as below, the part with red font is updated ones....

    Measure =
    VAR _fruitswithall =
    CALCULATETABLE (
    VALUES ( 'Table'[Fruit] ),
    FILTER ( 'Table', 'Table'[Type] = "ALL" )
    )
    RETURN
    IF (
    SELECTEDVALUE ( 'Table'[Fruit] ) I_fruitswithall,
    "ALL",
    CONCATENATE ( [Count], "" )
    )

    Best Regards

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi CTH2022 ,

    The label of the stacked column chart requires the value of the numeric type, and obviously the field with the value "ALL" is a Text type field. We can put this field under the Legend option. This is shown in the figure below.

    In addition, you can refer the following thread.

    Stacked column chart with text as data labels

    If the above one can't help you get the desired result, please provide some sample data refer in your stacked column chart with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

    How to upload PBI in Community

    Best Regards

    • CTH2022's avatar
      CTH2022
      Frequent Visitor

      Hi, Attached a picture to clarify the question.  Is the a way to display "ALL" for items with "ALL" as entry in coulmn B? Or is there is better visual that can be used for this kind of situation?

  • CTH2022's avatar
    CTH2022
    Frequent Visitor

    Say if  the data is updated as follow the next day, I want A:LL to be shown on Orange bar. Is there a way to change to measure to take care of this automatically?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi CTH2022 ,

      I updated the sample pbix file(see attachment), please check whether that is what you want. You can update the formula of Measure as below, the part with red font is updated ones....

      Measure =
      VAR _fruitswithall =
      CALCULATETABLE (
      VALUES ( 'Table'[Fruit] ),
      FILTER ( 'Table', 'Table'[Type] = "ALL" )
      )
      RETURN
      IF (
      SELECTEDVALUE ( 'Table'[Fruit] ) I_fruitswithall,
      "ALL",
      CONCATENATE ( [Count], "" )
      )

      Best Regards

      • CTH2022's avatar
        CTH2022
        Frequent Visitor

        Yes..This is what I wanted to to do. Thanks for the great hlep.