Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I’m trying to colour the month labels on a line chart so that:
Model:
Measures:
Issues Opened This Period :=
CALCULATE (
DISTINCTCOUNT ( Issues[ID] ),
USERELATIONSHIP ( Issues[Created on], dimDate[Date] )
)
Issues Closed This Period :=
CALCULATE (
DISTINCTCOUNT ( Issues[ID] ),
USERELATIONSHIP ( Issues[ActualClosedDate], dimDate[Date] ),
NOT ISBLANK ( Issues[ActualClosedDate] )
)
Issue Delta (Month) :=
VAR _y = SELECTEDVALUE ( dimDate[Year] )
VAR _m = SELECTEDVALUE ( dimDate[MonthNumber] )
RETURN
CALCULATE (
[Issues Opened This Period] - [Issues Closed This Period],
FILTER (
ALL ( dimDate ),
dimDate[Year] = _y
&& dimDate[MonthNumber] = _m
)
)
Axis Label Colour :=
IF ( [Issue Delta (Month)] > 0, "#C62828", "#3C3C3C" )Every month label is red, even months where [Issue Delta (Month)] is zero or negative (the table visual confirms the delta is calculated correctly).
Is there a better pattern for month-level conditional formatting on an X-axis that uses the date hierarchy?
Do I need to flatten the hierarchy and use a separate Year-Month column, or is there a trick to make the current approach respect the month granularity?
Any pointers appreciated - thanks!
Ori
Solved! Go to Solution.
Hi @OriAshkenazi , Thank you for reaching out to the Microsoft Community Forum.
Power BI doesn’t currently support per-category X-axis label colouring in native visuals, even if you use a flat Year-Month column, a disconnected table or precise filtering logic. You’ll need to use the Deneb custom visual. Deneb is free from AppSource and is built on Vega-Lite, which allows full control over how axis labels are styled, including binding a measure like your X Axis Label Colour directly to the label colour. Unlike Power BI’s native visuals, Deneb respects per-category formatting and data context from slicers and filters, so it can reflect your logic precisely.
All you need is a YearMonthText column in your date table, such as "2024-Jan" and your existing measures for opened, closed and colour logic. Then, in Deneb, you use a Vega-Lite JSON template that builds a dual-line chart and colours each X-axis label according to your measure. This approach guarantees that each month label reflects the correct status of the backlog, red when it grew, black when it didn’t and avoids the formatting aggregation issue completely.
If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @OriAshkenazi , Just checking in—were you able to resolve the issue?
If one of the replies helped, please consider marking it as "Accept as Solution" and giving a 'Kudos'. Doing so can assist other community members in finding answers more quickly.
Thank you!
Hi @OriAshkenazi ,
I hope the information shared was helpful. If you have any additional questions or would like to explore the topic further, feel free to reach out. If any of the responses resolved your issue, please mark it "Accept as solution" and give it a 'Kudos' to support other members in the community.
Thank you!
Hi @OriAshkenazi ,
I wanted to follow up and see if you’ve had a chance to review the information provided here.
If any of the responses helped solve your issue, please consider marking it "Accept as Solution" and giving it a 'Kudos' to help others easily find it.
Let me know if you have any further questions!
Hi @OriAshkenazi , Thank you for reaching out to the Microsoft Community Forum.
Power BI doesn’t currently support per-category X-axis label colouring in native visuals, even if you use a flat Year-Month column, a disconnected table or precise filtering logic. You’ll need to use the Deneb custom visual. Deneb is free from AppSource and is built on Vega-Lite, which allows full control over how axis labels are styled, including binding a measure like your X Axis Label Colour directly to the label colour. Unlike Power BI’s native visuals, Deneb respects per-category formatting and data context from slicers and filters, so it can reflect your logic precisely.
All you need is a YearMonthText column in your date table, such as "2024-Jan" and your existing measures for opened, closed and colour logic. Then, in Deneb, you use a Vega-Lite JSON template that builds a dual-line chart and colours each X-axis label according to your measure. This approach guarantees that each month label reflects the correct status of the backlog, red when it grew, black when it didn’t and avoids the formatting aggregation issue completely.
If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @OriAshkenazi ,
It sounds like you're using conditional formatting on the X-axis labels by month, and when one condition is met, the entire axis turns red – even for months that shouldn't.
This usually happens when the formatting logic is applied at the visual level instead of per data point. To fix this:
ColorMeasure =
SWITCH(
TRUE(),
[Month] = "January", "#FF0000",
[Month] = "February", "#00FF00",
"#000000"
)Then apply this measure to the Data colors > fx section in the formatting pane.
translation and formatting supported by AI
To provide more specifics, the primary DAX measure I've been using to generate the color codes for the X-axis labels, based on the advice to have a measure return different values per month, is structured as follows:
X Axis Label Color (SWITCH) =
VAR IssuesOpened = COALESCE([Issues Opened This Period], 0)
VAR IssuesClosed = COALESCE([Issues Closed This Period], 0)
RETURN
SWITCH(
TRUE(),
IssuesOpened > IssuesClosed, "#FF0000", // Red if Opened > Closed
"#000000" // Default to Black if Opened <= Closed
)
This measure relies on two base measures:
As mentioned previously, when I add this X Axis Label Color (SWITCH) measure to a table visual (with each month as a row), it correctly shows "#FF0000" for months where more issues were opened than closed, and "#000000" otherwise. However, the X-axis labels on the chart itself do not dynamically reflect these per-month color changes and tend to remain in a single state (e.g., all red).
When you apply conditional formatting to X-axis labels by month, sometimes Power BI turns the entire axis red if the logic isn’t quite right. Double-check your rules and make sure the formatting expression returns the correct colors for each label. Also, try testing with simpler conditions to isolate the issue.
Hi there,
I've now gone back and tested every suggestion, but unfortunately none of them changed the outcome – the entire X-axis still renders in one colour.
Given all of the above, it feels like a limitation (or bug) in how label colour is resolved when any date column is on the X-axis, not a problem in the measure itself.
If anyone has managed to get per-month label colours working on a date axis without custom visuals, could you please share the exact steps (or a sample PBIX)?
Thanks in advance for any fresh ideas.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 92 | |
| 70 | |
| 50 | |
| 40 | |
| 35 |