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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
AnkitaaMishra
Super User
Super User

Treemap conditional formatting help

Hi All,

I’m trying to apply conditional formatting on a Treemap visual in Power BI.
The requirement is to have two different color palettes applied dynamically based on the number of departments shown in the visual. Currently, I’m using the gradient option, where I can only define a single min → max color range.

AnkitaaMishra_0-1757570505160.png

 



However, I need the first half of the departments to follow one palette (e.g., Purple: #D0AAF0 → #2C0440) and the second half to follow another palette (e.g., Blue: #E1EBFF → #00297A).

Since the number of departments can grow (e.g., 20 today, 40 tomorrow), the logic should remain dynamic.

Is there any workaround or approach to achieve this in a single Treemap visual?

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @AnkitaaMishra ,

 

This is not an easy setup since you want to do a gradient and need to setup the gradient values.

 

Check this video with some advance DAX for colouring:

https://www.youtube.com/watch?v=c2mZimSeEL4

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

AnkitaaMishra
Super User
Super User

Hi @MFelix ,This is exactly what I was looking for! I created a DAX measure using HSLA colors, ranked the departments, and it worked perfectly. Huge thanks for sharing the solution! 🙂

View solution in original post

2 REPLIES 2
AnkitaaMishra
Super User
Super User

Hi @MFelix ,This is exactly what I was looking for! I created a DAX measure using HSLA colors, ranked the departments, and it worked perfectly. Huge thanks for sharing the solution! 🙂

MFelix
Super User
Super User

Hi @AnkitaaMishra ,

 

This is not an easy setup since you want to do a gradient and need to setup the gradient values.

 

Check this video with some advance DAX for colouring:

https://www.youtube.com/watch?v=c2mZimSeEL4

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors