Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I created a bar chart / To compare each month of two years that I select.
I set 2 measures : 1 by year.
And for each month , I check if it's Year to date (YTD) or year to go (YTG).
If I base color formula on YTD/YTG then I can have 2 different colors. But if I want to set different colors for each mesur then I don't succeed.
This is what I would like to get (light blue and light red for year to date / blue and red for ytg) :
This is what I get when color is only taking yTD/YTG (=if(Col_YTDYTG='YTD',rgb(148,180,212),rgb(68,119,170))
This is what I get when I try a condition based on year : $(V_BaseYear) = 2019 / $(V_ComparedYear) = 2021
=if(Col_Year=$(V_BaseYear),
if(Col_YTDYTG='YTD',rgb(225,163,173),rgb(204,102,119)),
if(Col_Year=$(V_ComparedYear),
if(Col_YTDYTG='YTD',rgb(148,180,212),rgb(68,119,170))
))
Thanks for your help
I posted a sample qs and data file
Thanks a lot @Sammy_AK
i see that you have used a combo chart, instead you need to use a Bar chart. Add 2 dimensions i.e. col_month & col_year and one measure which is $(vBaseYear) + $(vComparedYear). in the colors and legend option you can input your color expression to achieve your desired output. i have also attached the QVF file for your reference
if(Col_Year=$(V_BaseYear),
if(Col_YTDYTG='YTD',$(C_ComparedYTD_Color),$(C_ComparedYTG_Color)),
if(Col_Year=$(V_ComparedYear),
if(Col_YTDYTG='YTD',$(C_BaseYTD_Color),$(C_BaseYTG_Color))
))
Thanks a lot @Sammy_AK