The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have a report which includes a combined line stacked column chart, and have been asked to add data labels for the min and max values on the line.
I normally achieve this by creating another measure and using it for the data labels. This works fine for other chart types and for this chart when there is no legend used for the columns, but as soon as I add a legend to the columns, the data labels on the line revert back to showing the measure that is being charted - I've confirmed this by using a measure that's just a hardcoded constant value for the labels, so it doesn't appear to be to do with filter context.
I've recreated this in one of the PBI sample files - please see the screenshots below.
The file I used is here and my DAX is below.
DAX for measures used in the screenshots:
Screenshot 1: [Max avg order quantitiy label] measure used for line data labels. Charts are the same just with a legend added in the bottom one.
Screenshot 2: Constant Value measure
Hi @mrooney87 ,
When you use column legend, the categories in column legend are used as one of the criteria for filtercontext of the visual. Please show the max average quantity measure as a line as well, but it will only show one value.
Best regards,
Mengmeng Li
Thanks for your reply! Are you able to explain a bit more how the filter context has this impact, especially for the measure which is just = 1? It changes from showing all 1 to showing the values from Average order quantity, which does not make sense to me.
When I run the DAX query from performance analyser, I can see that Constant_Value is present in the table
In the meantime, I am using a similar workaround to what you suggested, and I have make the line colour white and removed the measure name because I don't want the labels measure to show up in the legend. But if there is a DAX solution, I would rather do that.
Hi @mrooney87 ,
This becuase Constant Value does not have any filter context, it just 1. Only measure can't clear the filter on the legend of the visual. In fact, when you use Legend, you can see that Text Lable does not even recognize the max average measure.
Best regards,
Mengmeng Li