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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Conditionally Formatting text values based on multiple associated numbers

I'm trying to figure out a way to format text values based on an associated number, but one text value could be associated with mutliple numbers. Is it possible to write a formula to take the AVG of associated numbers to format text values.

 

An example would be for part1, it shows up twice in the table with values 3 & 1 so it has an avg value of 2, part2 is has 2 & 1 so its avg is 1.5, and part 3 has an avg of 3. What would be the best way to take the average of numbers in column 4 to conditionally format values in column 3. I would like to do this for every column in a bigger data set so I want to avoid making new columns to store associated averages. 

MulberyPie_0-1652813049467.png

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

You can do this entirely in the Power BI user interface.  Use an implicit measure to show the average, and the same to create the conditional formatting.  See attached.

 

lbendlin_0-1652911739925.png

 

View solution in original post

@Anonymous Something like this?

 

lbendlin_0-1654026412847.png

 

 

see attached.

View solution in original post

8 REPLIES 8
lbendlin
Super User
Super User

You can do this entirely in the Power BI user interface.  Use an implicit measure to show the average, and the same to create the conditional formatting.  See attached.

 

lbendlin_0-1652911739925.png

 

Anonymous
Not applicable

The problem is if I want to conditionally format the vals, it doesn't take the average of the sets of values since the part column is different for val4. It takes the average value seperately for each instance of val4.

 

In this case the columns are being formatted by the average value of the hardiness cloumn. It shows tree as having two seperate avg values and seed as having seperate avg values. How could I get all similar values to have the same average

 

MulberyPie_0-1653494116190.png

 

Please provide sanitized sample data that fully covers your issue.

Please show the expected outcome based on the sample data you provided.

Anonymous
Not applicable

So I realized that it is just taking the average of the hardiness in a row, rather than the hardiness associated with the values. I want it to take the average value of the hardiness for all entries with value "maple" which would be 5 and format the cells with the value maple as green. Then all the values "bush" should have an average of 7.5 since the azelea bush has a hardiness of 6 and the holly bush has a hardiness of 9. I want it to take the average of all the similar values in a column, not just take the average of the exact same entries. Currently since there are two entries of "golf" "grass" "seed" it is taking the average of those 2 entries. I want it to take the average of every entry with "golf" (6), and seperately all the entries with "grass" (5.66), and "seed" (4.14) and format accordingly.

 

all columns are conditionally formated based on the hardiness row

MulberyPie_0-1653507026110.png

expected results (yellow 9-6.5) (green 6.49-3.51) (blue 3.5-1)

MulberyPie_0-1653508755074.png

 

data

SpeciesPlantTypeQuantityHardiness
hollybushleaf29
mapletreeleaf39
irisflowerbulb37
azeleabushleaf106
oaksaplingseed66
wildgrassseed85
ginkotreeleaf54
golfgrassseed33
oaktreeseed33
roseflowerbulb63
ginkotreeseed42
maplesaplingseed21
golfgrassseed39

You have two rows for golf-grass-seed .  Please indicate what the hardiness should be - 3 or 9 ?

Does the Quantity have any meaning?  If so - please describe it.

Anonymous
Not applicable

Use 3 for the golf grass seed. The quantity is just used for a weighted average calculation seperate from this. 

@Anonymous Something like this?

 

lbendlin_0-1654026412847.png

 

 

see attached.

Anonymous
Not applicable

Yes! That looks right! Sorry for not giving enough enough information initially. Thank you so much

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.