Home » Power BI » Highlighting the min & max values in a Power BI Line chart

Highlighting the min & max values in a Power BI Line chart

Display max & min values on line chart

In this blog, you will learn how to highlight maximum and minimum values in a Power BI Line chart.

Let’s get started-

Download the sample Dataset from below link-

Global_superstore_2016.xls

Follow these steps-

Step-1: Add a Line chart visualization to the Report canvas and drag some columns.

Line chart example

Line chart example



Step-2: Now create two measures for minimum and maximum sales, and write the following DAX code below.

MAX Sales =
VAR GetAllMarket = ALLSELECTED(Orders[Market])
VAR GetMaxValue= MAXX(GetAllMarket, CALCULATE(SUM(Orders[Sales])))
RETURN
IF(SUM(Orders[Sales]) = GetMaxValue, GetMaxValue, Blank())
MIN Sales =
VAR GetAllMarket = ALLSELECTED(Orders[Market])
VAR GetMinValue= MINX(GetAllMarket, CALCULATE(SUM(Orders[Sales])))
RETURN
IF(SUM(Orders[Sales]) = GetMinValue, GetMinValue, Blank())

Step-3: Now add both measures into visual.

Display min & max values on visual

Display min & max values on visual

Enable Data labels only for MIN & MAX values-

Follow these steps-

Step-1: Go to Format section > Enable Data labels.

Step-2: It will enables data labels for all, but we want see data labels only for max & min. so follow below steps-

Under Data labels > Enable customize series > and for Sales turned off Show.

Turned off Data labels for sales

Turned off Data labels for sales



Change Data color for MIN & MAX values-

Go to Format section > Data color > Change color individually.

Change Data colors for line chart

Change Data colors for line chart

Add Max & Min line into Line chart visual-

Refer for more details: Add max & min lines into line chart visuals

Select Line chart > Go to Analytics Pane > Add Min & MAX line for Sales.

Add max & min line into line visuals

Add max & min line into line visuals

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.

2 thoughts on “Highlighting the min & max values in a Power BI Line chart”

Leave a Reply