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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
NGC48
Helper I
Helper I

Clustered Column Conditional Formatting

Hi all,

I have what I feel should be a simle solution but cant work it out.

I have a column chart to display number of orders per weekday; I have calculated the Max & Min of the weekdays.

My problem is setting the column colours to match the result, i.e. if Thursday has the MIN value colour Red else Blue.

Tried the standard switch function wihtout luck 🙁.

Thanks in anticipation.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NGC48,

You can add a calculated column to your fact table to stored weekday and write a measure formula to use on condition color formation.

Calculate column

WeekdayName = FORMAT([Date],"ddd")

Measure:

color formatting =
VAR varTable =
    SUMMARIZE (
        ALLSELECTED ( 'fact' ),
        [WeekdayName],
        "Count", COUNTROWS ( 'fact' )
    )
VAR _min =
    MINX ( varTable, [Count] )
VAR _max =
    MAXX ( varTable, [Count] )
VAR _curr =
    CALCULATE ( COUNTROWS ( 'fact' ), VALUES ( 'fact'[WeekdayName] ) )
RETURN
    IF ( _curr = _min, "Red", IF ( _curr = _max, "Green", "Blue" ) )

14.png

Regards,

Xiaoxin Sheng

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Try

 

 

Color Category = SWITCH(true(),
Max(Sheet1[Weekday]) in weekday(Today()) && [value]=[Max weekly value],"Red",
"Blue"
)

 

Can you share sample data and sample output.

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank You Amitchandak.

I Have created an example using Northwind data;

Max Daily Count =
VAR ValueTable =
UNION(
ROW("Value", CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 1)),
ROW("Value", CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 2)),
ROW("Value",CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 3)),
ROW("Value", CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 4)),
ROW("Value", CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 5)),
ROW("Value",CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 6)),
ROW("Value",CALCULATE(COUNT(T_Orders[OrderID]),DateTable[WeekDayNum] = 7))
)
RETURN MAXX(ValueTable,[Value])
I am using a basic datetable:
 
example2.png
 
example1.png
Anonymous
Not applicable

Hi @NGC48,

You can add a calculated column to your fact table to stored weekday and write a measure formula to use on condition color formation.

Calculate column

WeekdayName = FORMAT([Date],"ddd")

Measure:

color formatting =
VAR varTable =
    SUMMARIZE (
        ALLSELECTED ( 'fact' ),
        [WeekdayName],
        "Count", COUNTROWS ( 'fact' )
    )
VAR _min =
    MINX ( varTable, [Count] )
VAR _max =
    MAXX ( varTable, [Count] )
VAR _curr =
    CALCULATE ( COUNTROWS ( 'fact' ), VALUES ( 'fact'[WeekdayName] ) )
RETURN
    IF ( _curr = _min, "Red", IF ( _curr = _max, "Green", "Blue" ) )

14.png

Regards,

Xiaoxin Sheng

Hi Xiaoxin Sheng, how wuld this work if I applied a date hierarchy; for example week number down to weekday?

if I ahve a day that matches the min I see that may work but not the max? for example the max for all Fridays could be 265, not single Friday will have the same value.

 

Regards, Noel

Thank You Xiaoxin Sheng 😊 is this the only way you would consider achiveing this? could the formtting be seperated from the calculation and still work as a sperate measure?

 

Regards, Noel

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.