21 Replies Latest reply: Apr 20, 2017 4:59 AM by Deepak Sharma

# Colour code by expreesion

Hi all ,

does the following code is correct? not working actually

if(Status='Sanctioned But Not Disbursed',\$(Blue),

if((Today-Date1)>=0 and (Today-Date1)<=1,\$(Pink),

if((Today-Date1)>=2 and (Today-Date1)<=3,\$(Yellow),

if((Today-Date1)>=4 and (Today-Date1)<=5,\$(Green),

if((Today-Date1)>=6 and (Today-Date1)<=14,\$(Blue),

if((Today-Date1)>=15 and (Today-Date1)<=30,\$(Blue),

if((Today-Date1)>=31,\$(Beige))))))))

Regards

Charlie

• ###### Re: Colour code by expreesion

if(Status='Sanctioned But Not Disbursed',Blue(),

if((Today()-Date1)>=0 and (Today()-Date1)<=1,RGB for Pink,

if((Today()-Date1)>=2 and (Today()-Date1)<=3,Yellow(),

if((Today()-Date1)>=4 and (Today()-Date1)<=5,Green(),

if((Today()-Date1)>=6 and (Today()-Date1)<=14,Blue(),

if((Today()-Date1)>=15 and (Today()-Date1)<=30,Blue(),

if((Today()-Date1)>=31,Rgb For Beige )))))))

• ###### Re: Colour code by expreesion

Regards

charlie

• ###### Re: Colour code by expreesion

Share sample data if possible

• ###### Re: Colour code by expreesion

Same expression working for dimension, but not for colour code .... and one more in the app, measure number formatting , there is a extension variable in the app , for amount  and Count , client want to see the amount in Cr format, count as default , any advice , PFA the app, and the extension  also sharaddha

Help is Appreciated

Charlie

• ###### Re: Colour code by expreesion

Try to calculate this extension in Load script and use that in front end.

eg

if(Status='Sanctioned But Not Disbursed',

if((Today-Date1)>=0 and (Today-Date1)<=1, '0-1 Days',

if((Today-Date1)>=2 and (Today-Date1)<=3, '2-3 Days',

if((Today-Date1)>=4 and (Today-Date1)<=5, '4-5 Days',

if((Today-Date1)>=6 and (Today-Date1)<=14, '6-14 Days',

if((Today-Date1)>=15 and (Today-Date1)<=30, '15-30 Days',

if((Today-Date1)>=31, '>30 Days')))))))   as Bucket

in chart use Dimension as Bucket

in Color expression use

pick(wildmatch(Bucket,'0-1 Days','2-3 Days','4-5 Days', '6-14 Days', '15-30 Days','>30 Days'),

rgb1,

rgb2,

rgb3,

rgb4,

rgb5,

rgb6)

• ###### Re: Colour code by expreesion

extension is different question , and colour code is different question

i didnot understand , confused a bit , can u be a bit clear ,

Regards

Charlie

• ###### Re: Colour code by expreesion

For Measure you can use

sum(if(vCarry='C',Count,

if(vCarry='A',Amount/10000000)))

• ###### Re: Colour code by expreesion

I want the amount to be shown as in crore yaar,

Regards

Charlie

• ###### Re: Colour code by expreesion

i did  chared the app , please check it out the colour code shraddha.

Regards

Charlie

• ###### Re: Colour code by expreesion

Hi,

I think (today -Date1 ) is not evaluating firstly you check ,it gives you required output or not,

Thanks

Paridhi

• ###### Re: Colour code by expreesion

find the App and change the colour code by expression.

• ###### Re: Colour code by expreesion

Can be rewritten as below, but what is Date1?? is it a number or a date or a string?

if(Status='Sanctioned But Not Disbursed',Blue()

,if((Today()-Date1)>=31,Rgb For Beige

,if((Today()-Date1)>=15,Blue()

,if((Today()-Date1)>=6,Blue()

,if((Today()-Date1)>=4,Green()

,if((Today()-Date1)>=2,Yellow()

))))))

• ###### Re: Colour code by expreesion

charlieon

You are trying to subtract a field Date1 which has multiple Date values, which is why the expression is failing, you can only subtract by one value by either choosing Min() or Max() Dates from that field

so try below, it worked for me

=if(Status='Sanctioned But Not Disbursed',\$(Jana_Yellow)

,if((Today()-Max(Date1))>=31,\$(Jana_Beige)

,if((Today()-Max(Date1))>=15,\$(Jana_Light_Blue)

,if((Today()-Max(Date1))>=6,\$(Jana_Dark_Blue)

,if((Today()-Max(Date1))>=4,\$(Jana_Green)

,if((Today()-Max(Date1))>=2,\$(Jana_Yellow),\$(Jana_Pink)

))))))

• ###### Re: Colour code by expreesion

Hi vineeth,

Thanks yaar .

Date1 is the date column in SourcingStatuswiseCount  table.

I ts working yaar but not completly ...

not all the colours are reflecting ..

Thanks& Regards

Charlie

• ###### Re: Colour code by expreesion

i will check and let you know

• ###### Re: Colour code by expreesion

Actually colours i mentioned random , but its not the sequence .

try with below if possible

1. RGB(250, 165, 25) - #faa519
2. rgb(255,180,10) - #ffb40a
3. rgb(255,191,0) - #FFBF00
4. rgb(255,182,193) - #FFB6C1
5. rgb(199,21,133) - #C71585
6. RGB(216, 16, 124) - #d8107c

or put one colour for one range yaar, try if u can please.

Thanks & Regards

charlie

• ###### Re: Colour code by expreesion

Do you want to evaluate Today() - min(Date1) or today()-Max(Date1) ?? because your expression also needs to be updated

• ###### Re: Colour code by expreesion

create your Day buckets during data load, and then refer them in the Color expressions

example

Pick(Match(DayBucket,'0-1 Days','2-3 Days',.........),red(),green(),......)

• ###### Re: Colour code by expreesion

use num function in your expression like below

If(num(Today())-num(Date1)>=1,Red(),Blue())