Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
eliasayy
Impactful Individual
Impactful Individual

Measure To Conditional Format Max and Min value in Column Chart

hello everyone,
https://1drv.ms/u/s!Ag9tIyk2ofNRjks_kZruHDia1fok?e=4HcsBy
i have pbix file here with the below pic

Screenshot 2022-10-10 142329.png


my goal is to conditional format the column bars of which value is the minimum to be red and the maximum to be green
i appreciate your help

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @eliasayy 

 

Please download the attached file.

Bar Chart Color = 
VAR _Max =
    CALCULATE (
        MAXX (
            ADDCOLUMNS ( VALUES ( 'Calendar'[Month] ), "AA", [Total Revenue] ),
            [AA]
        ),
        REMOVEFILTERS ( 'Calendar'[Month] )
    )
VAR _Min =
    CALCULATE (
        MINX (
            ADDCOLUMNS ( VALUES ( 'Calendar'[Month] ), "AA", [Total Revenue] ),
            [AA]
        ),
        REMOVEFILTERS ( 'Calendar'[Month] )
    )
RETURN
    SWITCH ( [Total Revenue], _Max, "Green", _Min, "Red" )

Output:

VahidDM_0-1665402647547.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @eliasayy 

 

Please download the attached file.

Bar Chart Color = 
VAR _Max =
    CALCULATE (
        MAXX (
            ADDCOLUMNS ( VALUES ( 'Calendar'[Month] ), "AA", [Total Revenue] ),
            [AA]
        ),
        REMOVEFILTERS ( 'Calendar'[Month] )
    )
VAR _Min =
    CALCULATE (
        MINX (
            ADDCOLUMNS ( VALUES ( 'Calendar'[Month] ), "AA", [Total Revenue] ),
            [AA]
        ),
        REMOVEFILTERS ( 'Calendar'[Month] )
    )
RETURN
    SWITCH ( [Total Revenue], _Max, "Green", _Min, "Red" )

Output:

VahidDM_0-1665402647547.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

eliasayy
Impactful Individual
Impactful Individual

Thank you very much will this work with calendar date heirarchy too? Or just the month?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors