The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a series of four visuals per year over a five year period (20 total). Each year uses a specific date range filter. I need to have the color in each visual the same for each year. The "default" color for 2019 is blue and I'm trying to change it to pink. Under Columns in format visual I have the categories set to All and pink is shown as the desired color. I've tried resetting the date ranges and also changing the field used for the legend with no change in results. Everytime I change the date range filter the color changes automatically but will not change to what I specifiy. I've tried conditional formatting but was not successful. What should I try next?
Solved! Go to Solution.
Thanks for providing the syntax. I will keep it for future use.
I found a solution, as least as it applies to my current project. The steps are shown below and must be done in the order shown. Please note this can impact other visuals so when completed check to see if the colors on other graphs need changing. I don't know why it works but am grateful it does.
Hi @Bryan_Schmidt
If I understood you correctly you want to apply color that depends on the field that is not shown in the graph (date).
To get the desired result you have to use conditional formatting.
For example :
if I have a slicer/filter like in the picture:
and want the 2020 be green and others orange, I need to create flag measures like:
result :
pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
You are correct in that I want to apply a color that depends on the field that is not shown in the graph (date). I want to use pink for 2019, dark blue for 2020, orange for 2021, purple for 2022, and light blue for 2023.
I'm guessing I need to create a new measure (flag) to do this but am not sure on what field to do it. My fields are shown below. The Year field has values from 2019 to 2023 and the YRcode (year code) has values from 4YP (for 2019), 3YP (for 2020), 2YP (for 2021), PY (for 2022), and CY (for 2023). Please advise how the syntax should be written for all five years and on what field the new measure should be added.
Hi @Bryan_Schmidt
The syntax is something like this:
the updated pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Thanks for providing the syntax. I will keep it for future use.
I found a solution, as least as it applies to my current project. The steps are shown below and must be done in the order shown. Please note this can impact other visuals so when completed check to see if the colors on other graphs need changing. I don't know why it works but am grateful it does.