Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sakshikaul
Creator II
Creator II

color combination in charts

Hi 

I want in sell through column if I want to show sell through percentage in different color 

if I have sell through percentage between 40 to 60 per then background color should be orange 

if i select sell through percentage below 40 then background color should be red 

if I want  sell through percentage above 60 then background color should be green Untitled.png

1 Solution

Accepted Solutions
sakshikaul
Creator II
Creator II
Author

Following is the code for the same.

=if(num(
(sum( {stateperfB<Sold_Date = {">=$(sstart)<=$(eend)"},[Season Code] = {$(MasterCurrentSeason)} >} quantity_sold)- sum( {stateperA< Sold_Date = {">=$(sstart)<=$(eend)"}, [Season Code] = {$(MasterCurrentSeason)}>} quantity_returns))

/
sum( {stateperfB<[Season Code] = {$(MasterCurrentSeason)} >} quantity_received)
,'#,##0%')>='60%',Green(),

if(num(
(sum( {stateperfB<Sold_Date = {">=$(sstart)<=$(eend)"},[Season Code] = {$(MasterCurrentSeason)} >} quantity_sold)- sum( {stateperA< Sold_Date = {">=$(sstart)<=$(eend)"}, [Season Code] = {$(MasterCurrentSeason)}>} quantity_returns))

/

sum( {stateperfB<[Season Code] = {$(MasterCurrentSeason)} >} quantity_received)
,

'#,##0%')<'40%',RGB (255,0,0),

if(num(
(sum( {stateperfB<Sold_Date = {">=$(sstart)<=$(eend)"},[Season Code] = {$(MasterCurrentSeason)} >} quantity_sold)- sum( {stateperA< Sold_Date = {">=$(sstart)<=$(eend)"}, [Season Code] = {$(MasterCurrentSeason)}>} quantity_returns))

/
sum( {stateperfB<[Season Code] = {$(MasterCurrentSeason)} >} quantity_received)
,

'#,##0%')='-%',white(),RGB(255,128,0))))

 

 

View solution in original post

7 Replies
jobsonkjoseph
Creator III
Creator III

Hi,

In expressions tab, when you expand the expression for the column, you'll see an option called "Background Colour"

select that and use the below sample script. Pls modify the fileds accordingly. Also the RGB values.

 

ColorMix2 (

if(rangemin(.5,rangemax(Sum (Margin)/Sum (Sales),-.5)) < 0,

-
Sqrt(-(rangemin(.5,rangemax(Sum (Margin)/Sum (Sales),-.5)))/(-.5)),

Sqrt((rangemin(.5,rangemax(Sum (Margin)/Sum (Sales),-.5)))/(.5))),

ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 255, 255))

sakshikaul
Creator II
Creator II
Author

Here I am not getting the correct color which I want 

I want red color when value is below 40%

i want orange color when value is between 40 % to 60 %

I want green color when value is above 60 % sell through value

 

i am using following code in background color option. please helpUntitled.png

ColorMix2 (

if(rangemin(.5,rangemax((Column(1)/column(2)),-.5)) < 0,

-Sqrt(-(rangemin(.5,rangemax((Column(1)/column(2)),-.5)))/(-.5)),

Sqrt((rangemin(.5,rangemax((Column(1)/column(2)),-.5)))/(.5))),

ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 255, 255))

sakshikaul
Creator II
Creator II
Author

@jobsonkjoseph

Please help 

jobsonkjoseph
Creator III
Creator III

Hi,
Pls change the ARGB values inside the braces to your required ones.
I'm not sure of the values you want, try to Google the rgb values please.
sakshikaul
Creator II
Creator II
Author

I want the value under sell through column should be presemted in different color 

If value is below 40 per then value should be red

above 60 per green and between 40 -60 per should be orange 

but here i am gtting only one color if I am changing the values in braces in below expression 

ColorMix2 (

if(rangemin(.5,rangemax((Column(1)/column(2)),-.5)) < 0,

-Sqrt(-(rangemin(.5,rangemax((Column(1)/column(2)),-.5)))/(-.5)),

Sqrt((rangemin(.5,rangemax((Column(1)/column(2)),-.5)))/(.5))),

RGB(255,165,0),RGB(255,255,0), RGB(255,255,0))

Untitled.png

 

sakshikaul
Creator II
Creator II
Author

Following is the code for the same.

=if(num(
(sum( {stateperfB<Sold_Date = {">=$(sstart)<=$(eend)"},[Season Code] = {$(MasterCurrentSeason)} >} quantity_sold)- sum( {stateperA< Sold_Date = {">=$(sstart)<=$(eend)"}, [Season Code] = {$(MasterCurrentSeason)}>} quantity_returns))

/
sum( {stateperfB<[Season Code] = {$(MasterCurrentSeason)} >} quantity_received)
,'#,##0%')>='60%',Green(),

if(num(
(sum( {stateperfB<Sold_Date = {">=$(sstart)<=$(eend)"},[Season Code] = {$(MasterCurrentSeason)} >} quantity_sold)- sum( {stateperA< Sold_Date = {">=$(sstart)<=$(eend)"}, [Season Code] = {$(MasterCurrentSeason)}>} quantity_returns))

/

sum( {stateperfB<[Season Code] = {$(MasterCurrentSeason)} >} quantity_received)
,

'#,##0%')<'40%',RGB (255,0,0),

if(num(
(sum( {stateperfB<Sold_Date = {">=$(sstart)<=$(eend)"},[Season Code] = {$(MasterCurrentSeason)} >} quantity_sold)- sum( {stateperA< Sold_Date = {">=$(sstart)<=$(eend)"}, [Season Code] = {$(MasterCurrentSeason)}>} quantity_returns))

/
sum( {stateperfB<[Season Code] = {$(MasterCurrentSeason)} >} quantity_received)
,

'#,##0%')='-%',white(),RGB(255,128,0))))

 

 

jobsonkjoseph
Creator III
Creator III

Hi
Thanks for sharing.