PowerBI

Highlight the lowest value in PowerBI (DAX)

In some cases you might want to highlight the lowest value in a powerbi chart.

Here is a sample of a published PowerBI Chart based on the Rotten Tomatoes movie dataset.
Each bar represents a month – the month with the lowest number of movie releases is highlighted in red.

First create the new measure that will Count the Number of Films
I’m calling this one [MovieCounter]

MovieCounter = COUNT(RottenTomatoesMovies[movie_title])

Now create a relationship in the data modelling view from the Movie Table (Using Release date) to the Calendar Table (For more info on creating a calendar table refer to my previous blog post URL….)

Create a New Measure that will return a color based on the minimum value for a selected filter combination

Lowest Monthly Releases = 
    VAR _monthlyReleases =
        CALCULATETABLE(
            ADDCOLUMNS(
                SUMMARIZE('DateTable',DateTable[Month],DateTable[Month Number]), //representing your Date Table
                "@ReleaseCount", RottenTomatoesMovies[MovieCounter] //The Measure which is basis of highlighted color
            ),ALLSELECTED()
        )
    VAR _minReleases =
        MINX(_monthlyReleases,[@ReleaseCount])
    VAR _currentReleases = [MovieCounter]
    VAR _result = IF(_minReleases = _currentReleases, "Red", "#118DFF")
    return
_result

Create a Bar chart with the Month on the Axis and Values = MovieCounter. Select the Bar Chart Formatting Options >> Data Colors >> Choose Formula. Set Format By = Field Value. And select the Measure created above for “Based on field” value.

And that should do the trick. i’ll create a follow up post on how i animated the year filter.

Author : James Botes

James Botes is a Cape Town Senior Business Analyst (CBAP) with a keen interest in Systems Thinking & Solving Business Problems. Founder and Creator of the site and you tube channel BASensei. Linkedin : https://www.linkedin.com/in/james-botes-73a63b67/

Leave a Reply

Your email address will not be published. Required fields are marked *

five + three =