Forum Discussion
Dynamically changing colors in Bar chart
Hi Everyone,
I have a requirenment to display a different color for bar based on the condition.
In the below screenshot the text Internal Audit (3rd line of Defense) is coming from Table 1, and the bar chart with Y axis values are coming from Table 2. The requirenment is to display Internal Audit (3rd line of Defense) ( 2nd bar) bar in any different color (for example red). I want to compare the texts from both the tables and the matched texts should show in different color.
Please find the below sample data. If we select the filter Company A then in the bar chart Internal Audit (3rd line of Defense) bar should higlight in diffent colour since the company A 's text value is Internal Audit (3rd line of Defense).
| Table 1 | |
| Text | Company |
| Internal Audit (3rd line of Defense) | A |
| Direct assistance | B |
| Management testing | B |
| Other (please describe) | C |
| Table 2 | |
| Text value | Measure |
| Internal Audit (3rd line of Defense) | 10 |
| Direct assistance | 20 |
| Other (please describe) | 30 |
Please help me to achieve this.
Thanks in advance.
Try modifying the measure as
Measure 2 = IF ( VALUES ( Table2[Text value] ) IN VALUES ( Table1[Text ] ), "#6c1610" )
9 Replies
- Zubair_MuhammadCommunity Champion
Hi Kavya123
you can Define a MEASURE like following and use it for conditional formatting
Measure 2 = IF ( SELECTEDVALUE ( Table2[Text value] ) = SELECTEDVALUE ( Table1[Text ] ), "#6c1610" ) - Zubair_MuhammadCommunity Champion
- Kavya123Helper III
Hi Zubair Muhammad,
Thanks for ther reply. It is working for single text value. For company B there are two texts. If i select company B (Direct assistance,Management testing) both bars should highlight.
- Zubair_MuhammadCommunity Champion
Try modifying the measure as
Measure 2 = IF ( VALUES ( Table2[Text value] ) IN VALUES ( Table1[Text ] ), "#6c1610" )