Forum Discussion
Custom Reference Line Using DAX
- Anonymous1 year ago
Hi mdm2025,
since the combo chart isn’t fitting your visual needs, and you are trying to show a separate custom line for each column using a measure, your current workaround with an extra column makes sense for now.
At the moment, Power BI doesn’t have a built-in way to draw individual lines on each bar using a measure. That’s why people usually go for the combo chart method, even though it has its own limitations.
Hope this helps if you have any queries we are happy to assist you further.
Best Regards,
Harshitha.
Hi ,
To create per-category reference lines, use a Line and clustered column chart plus a custom DAX measure. First, define a measure that returns the desired “target” for each category (e.g. day of week) using SWITCH and SELECTEDVALUE. For example, if your axis is the day of the week, you could write:
Custom Reference Line =
SWITCH(
SELECTEDVALUE('Date'[Day Name]),
"Monday", 1500,
"Tuesday", 1300,
"Wednesday", 500,
"Thursday", 1200,
"Friday", 900,
"Saturday", 800,
"Sunday", 700,
BLANK()
)
Add the measure to the combo chart: In a Line and clustered column chart, put your primary measure in the Column values and the new Custom Reference Line measure in the Line valuescommunity.fabric.microsoft.com. Power BI will draw a horizontal line at the specified value for each column, effectively simulating a reference line per category.
Optional – use tooltips: You can also include the custom measure in the tooltip to display exact values on hover.
The result looks like this:
Figure: A line-and-column chart where each day’s column is shown in blue and the custom reference line (target) in greencommunity.fabric.microsoft.comcommunity.fabric.microsoft.com.And with tooltips enabled, hovering over a column shows both the column value and the target. For example, hovering on Monday displays a tooltip with Order Quantity = 1884 and Custom Reference Line = 1500:
Figure: Tooltip for Monday showing Order Quantity (1884) and the Custom Reference Line value (1500)community.fabric.microsoft.com.Steps summary:
Create a DAX measure using SWITCH(SELECTEDVALUE(...)) to output the target for each categorycommunity.fabric.microsoft.comcommunity.fabric.microsoft.com.
Use a Line and clustered column chart, placing the main measure in the column values and the custom measure in the line valuescommunity.fabric.microsoft.com.
(Optional) Add the measure to tooltips for clarity.
This approach fully achieves per-column reference lines using DAX in Power BI.