Forum Discussion

Vinesh23's avatar
Vinesh23
New Member
8 months ago
Solved

Line chart - conditional marker color and labels only for specific months (native visual limitation)

Hi everyone, I’m working on a maintenance KPI trend in Power BI Desktop and facing a limitation with the native line chart. Requirement: Show a continuous FPM (%) line by Fiscal Month. Displa...
  • Jaywant-Thorat's avatar
    8 months ago

    Hi Vinesh23 

    This is a native Power BI line chart limitation. What you want (all together in one native visual) is NOT supported today.

    Why your attempts fail (expected behavior):

    • BLANK() → breaks the line (by design)
    • Marker color cannot be conditionally formatted
    • Data labels are all-or-nothing
    • Scatter plot ≠ reliable timeline + legend behavior

    What actually works (native-only options):
    Option 1 : Overlay 2 visuals - Common & Recommended

    • Visual 1: Line chart
      • Continuous FPM line
      • No markers
    • Visual 2: Scatter chart
      • Only rebuild months
      • Red markers
      • Data labels ON
    • Sync axes + transparent background
      • Native
      • Clean
      • Performant
      • Production-safe

    Option 2: Line chart + constant lines (partial)

    • Use Analytics pane
    • Add vertical lines for rebuild months
    • Add tooltip / label via page tooltip
    • No red markers
    • Less intuitive

    Option 3: Accept limitation

    • Show all markers
    • Single color
    • Use tooltip to highlight rebuilds

    What you cannot bypass:

    • No DAX workaround
    • No formatting hack
    • No hidden setting
    • Legend blocks most advanced tricks

    Remember:

    This scenario is officially not supported in a single native Power BI visual.

    To meet all requirements, you must use:

    • Overlaid native visuals OR
    • Deneb / custom visual (if allowed)

    =================================================================
    Did I answer your question? Mark my post as a solution! This will help others on the forum!

    Appreciate your Kudos!!

    Jaywant Thorat | MCT | Data Analytics Coach | Super User
    LinkedIn: https://www.linkedin.com/in/jaywantthorat/
    Join #MissionPowerBIBharat: https://tinyurl.com/JoinMissionPowerBIBharat
    #MissionPowerBIBharat
    LIVE with Jaywant Thorat

  • danextian's avatar
    8 months ago

    Hi Vinesh23 

    The native visuals do not support conditonal formatting when legends are added. You can make the visual appear to look like it does but a bit finnicky to setup.

     

    Create a disconnected table with the legend category repeated twice - one for the line and another .

    for the marker.

    Create a measure that references this table and conditionally returns a value depending on the type.   Total Revenue and Max Point are calculated separately and TREATAS is used to propagate a virtual relationship betwen the disconnected and Category tables. In the below measure, I'm return the marker only if it is equal to the max value among all the values in the visible row.

    Category2 Value = 
    VAR _type = SELECTEDVALUE ( Category2[Type] )
    RETURN
    SWITCH (
        TRUE (),
        _type = "Line",
            CALCULATE (
                [Total Revenue],
                TREATAS ( VALUES ( Category2[Category] ), Category[Category] )
            ),
        _type = "Marker",
            CALCULATE (
                [Max Point],
                TREATAS ( VALUES ( Category2[Category] ), Category[Category] )
            )
    )
    

    Markers are enabled for all categories, but they are set to transparent for those with a Line type. While it’s possible to enable markers only for the Marker type, doing so ensures there are no visible marker borders that inherit or match the line colors when hovering over an active marker. The visible markers are set to have the same color. As to the legend, it is disabled for the line chart and another visual is used to show just the legends for Line Type.

    Please see the attached pbix.