Forum Discussion
Treemap color with objectives
- 6 years ago
Hi,
According to your description, I create a table to test:
Please take following steps:
1)Create a measure to set conditional format color:
Measure = SWITCH ( TRUE, SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 0.9, "#800000", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 0.9 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 0.92, "#B50000", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 0.92 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 0.94, "#FF0000", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 0.94 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 0.96, "#B55B00", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 0.96 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 0.98, "#FFC300", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 0.98 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 1, "#FFFF00", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 1 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 1.02, "#00FF00", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 1.02 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 1.04, "#00D100", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 1.04 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 1.06, "#00A000", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 1.06 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 1.08, "#006900", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 1.08 && SELECTEDVALUE ( 'Table'[Scores] ) < 50 * 1.1, "#004500", SELECTEDVALUE ( 'Table'[Scores] ) > 50 * 1.1, "#004000" )And it shows:
2)Create a calculated table:
Standard = ADDCOLUMNS(GENERATESERIES(-0.1,0.12,0.02),"Level",[Value]*0+1)Then, add a column to this table:
Column = ROUND(Standard[Value],2)3)Create a measure to set this calculated table's conditional format color:
Measure 2 = SWITCH ( TRUE, SELECTEDVALUE ( Standard[Column] ) = -0.1, "#800000", SELECTEDVALUE ( Standard[Column] ) = -0.08, "#B50000", SELECTEDVALUE ( Standard[Column] ) = -0.06, "#FF0000", SELECTEDVALUE ( Standard[Column] ) = -0.04, "#B55B00", SELECTEDVALUE ( Standard[Column] ) = -0.02, "#FFC300", SELECTEDVALUE ( Standard[Column] ) = 0, "#FFFF00", SELECTEDVALUE ( Standard[Column] ) = 0.02, "#00FF00", SELECTEDVALUE ( Standard[Column] ) = 0.04, "#00D100", SELECTEDVALUE ( Standard[Column] ) = 0.06, "#00A000", SELECTEDVALUE ( Standard[Column] ) = 0.08, "#006900", SELECTEDVALUE ( Standard[Column] ) = 0.1, "#004500" )4)Choose a treemap visual:
And it shows:
Here is my test pbix file:
Best Regards,
Giotto Zhi
- 6 years ago
v-gizhi-msft
Thank u so much i really appreciate your help 🙂
I did it.
For everyone which have problem like mine, must folow like on the picture below
amitchandak thanks for your answer but i used it to add a color to try if the diagram works properly.
Now I add a aim/objectives and i need set the color for a results which i connected with aim/objectives.
If possible please share a sample pbix file after removing sensitive information. Bases on that data let us know what color you want.
I used a measure. So I have different. Option. You can even create a Measure and return colors based on condition. And in advance control, you can use that field value.
eaxmple
Color Column = if('Date'[date]<TODAY(),"green","red")
Color Measure = if(FIRSTNONBLANK('Date'[date],TODAY()) <today(),"lightgreen","red")
My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
- adiolka6 years agoFrequent Visitor
Sure, i will share. I thinking about
Mayby its additional widget ? Or if no, how can i create it ?
- adiolka6 years agoFrequent Visitor
Already i almost do this.
I used if and switchBut on this moment i have 2 colors, green and red. If i have interval from -...% to +...% which command i can use for create orange color ? For example if i have % on + ( 0-100% ) i have red color, if i have from 0% to Max -5% i have orange color, and if i have -...% i have green color ?