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
WJ876400
Helper IV
Helper IV

conditional formatting

Hi

 

I have the below table, the number of students is a count of the students ID and the % of total is the students ID but as a percentage of the row total. I want to format the background colour but just for the % of total column which are RED. I want to coulor the background Red if it is over 10%, Amber if it is 3-9% and Green if under 3%. Is there a way to do this?, thanks for any help

 

WJ876400_0-1613059308312.png

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @WJ876400 

According to your description and sample picture, you want to set the conditional format for the [% of Total] for the color Red, right?

You can try my steps:

This is the test data I created according to your sample picture:

v-robertq-msft_0-1613113901354.png

  1. Create these measures:
Number of students =

COUNTX(FILTER(ALLSELECTED('Table'),[ID]=MAX('Table'[ID])),[ID])
% of Total =

var _total=COUNTX(ALL('Table'),[ID])

return

DIVIDE([Number of students],_total )
Color format =

SWITCH(

    TRUE(),

    [% of Total]>0.1,"Red",

    [% of Total]<=0.1&&[% of Total]>=0.03,"Orange",

    [% of Total]<0.03,"Green"

)
  1. I created a Matrix and place these columns and measures, then open the conditional format like this:

v-robertq-msft_1-1613113901365.png

v-robertq-msft_2-1613113901373.png

 

And you can get what you want, like this:

v-robertq-msft_3-1613113901379.png

 

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

View solution in original post

1 REPLY 1
v-robertq-msft
Community Support
Community Support

Hi, @WJ876400 

According to your description and sample picture, you want to set the conditional format for the [% of Total] for the color Red, right?

You can try my steps:

This is the test data I created according to your sample picture:

v-robertq-msft_0-1613113901354.png

  1. Create these measures:
Number of students =

COUNTX(FILTER(ALLSELECTED('Table'),[ID]=MAX('Table'[ID])),[ID])
% of Total =

var _total=COUNTX(ALL('Table'),[ID])

return

DIVIDE([Number of students],_total )
Color format =

SWITCH(

    TRUE(),

    [% of Total]>0.1,"Red",

    [% of Total]<=0.1&&[% of Total]>=0.03,"Orange",

    [% of Total]<0.03,"Green"

)
  1. I created a Matrix and place these columns and measures, then open the conditional format like this:

v-robertq-msft_1-1613113901365.png

v-robertq-msft_2-1613113901373.png

 

And you can get what you want, like this:

v-robertq-msft_3-1613113901379.png

 

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

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 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.

Top Solution Authors