Conditional Formatting in Line Charts: Highlighting Peak (Max) & Valley (Min) Points
Overview & Learning Objectives
Unlike Bar and Column charts, Power BI Line Charts do not have a native "fx" button to color the entire continuous line conditionally. Professional BI architects solve this using a powerful DAX engineering pattern: authoring isolated Max and Min point measures, plotting them as secondary series with zero line stroke, and styling custom colored data markers (e.g. Green dot for Peak, Red dot for Valley).
- Understand why continuous line strokes cannot be conditionally formatted natively.
- Write DAX measures using MAXX, MINX, and ALLSELECTED to calculate peak and floor points dynamically.
- Configure secondary marker series with stroke width = 0 to render distinct colored dots.
- Apply dynamic conditional formatting on data labels to show exact values only at peak and valley moments.
Industry Standard
Standard: Top enterprise reporting dashboards at Bloomberg and Apple highlight peak and valley values with colored focal dots, guiding executive eyes immediately to all-time highs and operational dips.
Real-World Example: Gelato Bar Monthly Revenue Trajectory
Gelato Bar tracks monthly sales over 24 months. The CFO wants the highest revenue month highlighted with a bold Green dot and value label, and the lowest month marked with a Red dot, with all other months remaining neutral blue.
| Month | Total Sales (₹) | Max Point Measure | Min Point Measure | Marker Displayed |
|---|---|---|---|---|
| May 2025 (Peak Summer) | 8,40,000 | 8,40,000 | BLANK() | Large Green Dot + "₹8.4L" |
| Jun 2025 | 7,20,000 | BLANK() | BLANK() | None (Clean line stroke) |
| Jan 2026 (Winter Low) | 2,90,000 | BLANK() | 2,90,000 | Large Red Dot + "₹2.9L" |
| Feb 2026 | 3,50,000 | BLANK() | BLANK() | None (Clean line stroke) |
Functions Covered in this Chapter
Here is the definition, exact syntax, parameter breakdown, and real-world business example for each function covered in this chapter:
Step 1: Peak (Max) Point DAX Measure
Definition: Calculates whether the current date in the visual matches the maximum sales across the entire active filtered period. Returns the sales value if it is the peak, otherwise returns BLANK().
Max Sales Point =
VAR CurrentSales = [Total Sales]
VAR MaxSalesInView = MAXX(ALLSELECTED(Dim_Calendar[Date]), [Total Sales])
RETURN
IF(CurrentSales = MaxSalesInView, CurrentSales, BLANK())
ALLSELECTED(Date): Scans all dates currently visible in the line chart (respecting user slicers).MAXX(...): Finds the single highest sales value in that date window.BLANK(): Crucial: returning BLANK() ensures no point or label is plotted for normal days.
[Max Sales Point] evaluated for May 2025 vs June 2025Step 2: Floor (Min) Point DAX Measure
Definition: Calculates whether the current date matches the minimum sales in the active filtered period. Returns the value if it is the lowest point, otherwise returns BLANK().
Min Sales Point =
VAR CurrentSales = [Total Sales]
VAR MinSalesInView = MINX(ALLSELECTED(Dim_Calendar[Date]), [Total Sales])
RETURN
IF(CurrentSales = MinSalesInView, CurrentSales, BLANK())
MINX(...): Finds the single lowest sales value in the visible period.CurrentSales = MinSalesInView: Checks equality to isolate the exact lowest trough.
[Min Sales Point] evaluated for January 2026Step 3: Visual Formatting & Zero-Stroke Markers
Definition: Drop [Total Sales], [Max Sales Point], and [Min Sales Point] into the Y-axis. Set line stroke width to 0 for the Max and Min series, leaving only large distinct markers visible.
Format Visual -> Lines -> Series: "Max Sales Point" -> Stroke width: 0 px -> Markers: ON -> Shape: Circle -> Size: 10 -> Color: #16a34a
Stroke Width: 0 px: Hides the line connecting the point, preventing secondary line clutter.Markers -> Size & Color: Customizes the marker dot (e.g. Size 10 Green circle for Max, Red diamond for Min).Data Labels -> Series Specific: Turn ON data labels ONLY for Max and Min series so numbers appear only at key moments.
Continuous sleek blue line with one glowing Green dot at peak and one Red dot at lowest dip.Common Mistakes & Limitations
- Returning 0 instead of `BLANK()` in the IF statement (`IF(Sales=Max, Sales, 0)`); this causes Power BI to plot a dot at the very bottom (zero) for all 364 other days!
- Using `ALL(Calendar)` instead of `ALLSELECTED(Calendar)`; `ALL` ignores user slicers, while `ALLSELECTED` correctly identifies the peak within whatever date range the user filtered.
Keyboard Shortcuts
| Action | Windows | Mac |
|---|---|---|
| Duplicate Measure for Quick Edits | Right-click measure -> Copy DAX | Right-click -> Copy |
| Format Data Labels | Format Visual -> Data Labels -> Series Selection | Data Labels menu |
Pro Tips & Modern Alternatives
- In modern Card visuals or Table/Matrix visuals, use native `fx` conditional formatting by rules.
- Use the Color by Measure pattern (`Point Color = SWITCH(...)`) to dynamically format marker borders.