Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All. I am currently banging my head trying to get what I thought was a simple conditional formatting (RAG indicator) to appear on a single bar chart. Thanks in advance if someone can point me in the right direction and if I find a solution beforehand I shall post here for the community.
Scenario and Data
I have multiple rows that represent "projects" which have columns for [Targets] both annual and monthly and also a column for [Enabled].
I am aiming to produce a bar chart that shows the total [Enabled] with the [Target] amount shown as a dashed line. This bit I have managed quite easily with a standard KPI style bullet bar chart.
The next step is to add conditional formatting based on the rule below that changes the colour of the bar depending on it's relationship with the [Target column]
Rule
2019/20 Savings RAG = if([Enabled 2019/20]>=[Savings Targets 2019/20],"Blue",if([Enabled 2019/20]>=[2019/20 Current Month Target],"Green",if(month(edate(now(),-3))<7,if([Enabled 2019/20]>=([2019/20 Current Month Target]*0.7),"Amber","Red"),"Red")))
In summary, various conditions and thresholds trigger different colours (Blue, Green, Amber, Red).
Attempts
I have attempted to split the colours up to different columns and if true return 1 and if false return 0. For example:
2019/20 RAG Blue = if([Enabled 2019/20]>=[Savings Targets 2019/20],1,0)
Best Regards,
Mark
Solved! Go to Solution.
Hi @Anonymous
You could create a measure like below, essentially its your rules with colours replaced with numbers.
coloursX = SWITCH( TRUE, [Enabled 2019/20] >= [Savings Targets 2019/20], 1, --Blue [Enabled 2019/20] >= [2019/20 Current Month Target], 2, -- Green MONTH( EDATE( NOW(), -3 ) ) < 7 && [Enabled 2019/20] >= ( [2019/20 Current Month Target] * 0.7 ), 3, --Amber 0 --Red )
Next, in the Visualization Pane > Format > Data Colors, Click on the 3 dots and Select Conditional Formating to open the options ( as on the sreenshot below )
Once in the Conditional Formatting settings, just make sure you set everything as below
Hi @Anonymous
You could create a measure like below, essentially its your rules with colours replaced with numbers.
coloursX = SWITCH( TRUE, [Enabled 2019/20] >= [Savings Targets 2019/20], 1, --Blue [Enabled 2019/20] >= [2019/20 Current Month Target], 2, -- Green MONTH( EDATE( NOW(), -3 ) ) < 7 && [Enabled 2019/20] >= ( [2019/20 Current Month Target] * 0.7 ), 3, --Amber 0 --Red )
Next, in the Visualization Pane > Format > Data Colors, Click on the 3 dots and Select Conditional Formating to open the options ( as on the sreenshot below )
Once in the Conditional Formatting settings, just make sure you set everything as below
Much appreciated this works a charm. I added sum() to the columns within the measure and this cleared any errors I subsequently had.
Thanks again. Mark
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
97 | |
82 | |
74 | |
66 |
User | Count |
---|---|
120 | |
105 | |
99 | |
81 | |
72 |