Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Define fixed colours for legend

Hello,

I have the following table in Power Query and the data is shown in a stacked column chart visualization in Power BI with the legend showing a different colour for each city. The problem is when the data is refreshed or when a city is added or removed, the colour for the other cities change randomly. Is there a way to set specific colours for each city automatically? Maybe a conditional column or some other way to assign a city to a specific number which would equal to a specific colour? Is this possible? Any help is much appreciated!

 

DateTurkeyMoscowLondonSaint PetersburgBerlinMadridKievRomeParisBucharestMinskViennaBudapestHamburgWarsaw
03/01/2022nullnull161171591568296588null8815nullnull
10/01/2022nullnull161221591576326589null8819nullnull
17/01/2022nullnull161231681694247086null9014nullnull
24/01/2022nullnull141261721670285891null9813nullnull
31/01/2022nullnull111081741272276688null9211nullnull
07/02/2022nullnull16871781470325793null9612nullnull
14/02/2022nullnull16691741577316089null9314nullnull
21/02/2022nullnull15671661376286686null7812nullnull
28/02/2022nullnull15841661559327592null9315nullnull
07/03/2022nullnull16571871767297083null9614nullnull
14/03/2022nullnull15461721477286691null9917nullnull
21/03/2022nullnull15471791589317887null8716nullnull
28/03/202224null15531761491287385null8919nullnull
04/04/202224null14811771576257188116821778null
11/04/20223null161181821566296387135931483null
18/04/2022201815142172226529759413793null120null
25/04/202215151316516287130789513286null119null
02/05/2022162116167150168029739112997null125null
09/05/20222117151681691672297193129100null130null
16/05/2022291716171168167032769112797null132null
23/05/20222614151691811282327592125102null133null
30/05/2022281816175177148331759013199null126null
06/06/2022321815178175148726789013399null128null
13/06/2022281615175184159431709013494null129null
20/06/2022261616176182169132739112290null132null
27/06/2022231513182195168432689412788null115null
04/07/2022321515181198168331659412892null114null
11/07/2022351512181194168132608713289null125null
18/07/202235149180192168430628913179null127null
25/07/2022301512171210168032658213787null121null
01/08/2022201614179234138232658412292null118null
08/08/2022222013179226168232769011596null117null
15/08/2022231813179226168532779011696null117null
22/08/20222519111782391478308092127104null108null
29/08/20222719131722311690297989119105null91null
05/09/202225202283255148531808812092null10452
12/09/2022252222100260148529779312482null11848

 

Currently, the only way that i can solve this is by manually going through the list below and setting the colour for each city.