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
I tried color Sales heat map by Margin Using Advance Control in Data color. If this can help
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
- adiolka6 years agoFrequent Visitor
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.
- amitchandak6 years ago
Super User
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 ?