Forum Discussion

derekli1700's avatar
derekli1700
Helper III
4 months ago
Solved

Data Label won't show on Line & Clustered Column Chart unless Legend or Column y-axis field is empty

 

First pic shows what my current Line and Clustered Column chart looks like, representing stock levels. 

Normally i would go to Data Labels -> apply series to Annotation Point -> Detail -> Data field to "Annotation Label" and it would show my data labels. However, this seems to only work if my legend or column y-axis field is empty. (as seen below)

Is there a way to fix this? Not sure if this is a dax issue or formatting.


Below is the dax for the "annotation label" referenced in Data Labels:

 

Annotation Label = 
VAR CurrentLabel = SELECTEDVALUE('Chart Axis'[Label])
RETURN
SWITCH(
    CurrentLabel,
    "April", "Order",
    "August", "Replenish",
    BLANK()
)

 

  • derekli1700 

    The value for line chart can't be text. We can only display numbers

    However, you can add it in the label details.

3 Replies

  • derekli1700 

    The value for line chart can't be text. We can only display numbers

    However, you can add it in the label details.

  • When the Legend or Column y-axis is empty, each point on the visual has a single row in filter context, so SELECTEDVALUE on the axis label returns cleanly. The moment you add a Legend, each axis position now has multiple rows in context and SELECTEDVALUE returns BLANK because it can no longer resolve a single value. So I believe you could try using a measure as below if the values are same for every legend:

     

    Annotation Label =
    VAR _CurrentLabel =
        MAX ( 'Chart Axis'[Label] )
    RETURN
        SWITCH (
            _CurrentLabel,
            "April",  "Order",
            "August", "Replenish",
            BLANK ()
        )

     

    • v-menakakota's avatar
      v-menakakota
      Community Support

      Hi derekli1700 ,
      Thanks for reaching out to the Microsoft fabric community forum. 


      I would also take a moment to thank  ryan_mayu  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
      I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

      Best Regards, 
      Community Support Team