Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

ashissau
Contributor III

Text color in red for calculated dimension

Hi,

I have a calculated dimension like the following

aggr(sum({<xxx=,Date={"$(vVariable)"}>}YYYY),AAA,BBB))

I want to print negative value in Red. so in text color I put the below code

if(  aggr(sum({<xxx=,Date={"$(vVariable)"}>}YYYY),AAA,BBB)))<0,RGB(255,0,0),black()

As a result I am getting some negative value as red and some negative value are not in red. This is very strange .

Even if I put NUM function before the aggr the result is same.

Any help much appreciated.

28 Replies

Re: Text color in red for calculated dimension

Perhaps this?

if(Sum(Aggr(Sum({<xxx=,Date={"$(vVariable)"}>}YYYY),AAA,BBB))<0,RGB(255,0,0),Black())

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
ashissau
Contributor III

Re: Text color in red for calculated dimension

Thank you Anil for your reply, I tried with Sum as you said , however getting same result.

For some negative value I am getting it red and for some negative value I am getting black.

devarasu07
Honored Contributor II

Re: Text color in red for calculated dimension

Hi,

use actual expression instead of variable. i too faced similar issue while applied text color in a dimension field value.

or share your variable expression, mock data, i can help  you

Thanks,
Deva

ashissau
Contributor III

Re: Text color in red for calculated dimension

Thank you Devarasu, my vVariable is the date that is coming from a selection. If I do not use variable to pass date in the expression , how would I do alternately.

devarasu07
Honored Contributor II

Re: Text color in red for calculated dimension

Hi,

Can you share your mock app.

also u can try like below,

if ( aggr(sum({<xxx=,Date={"$(=max(Date))"}>}YYYY),AAA,BBB)) <0 ,RGB(255,0,0),Black())

ashissau
Contributor III

Re: Text color in red for calculated dimension

Even if I remove the variable from the expression , the result is same.

Re: Text color in red for calculated dimension

Can you try this first

If(Sum({<xxx=,Date={"$(vVariable)"}>}YYYY) <0, 1,0)


And then check with below

if(Sum(Aggr(Sum({<xxx=,Date={"$(vVariable)"}>}YYYY),AAA,BBB))<0,1,0)


​Can you show the image after this with Value in text box?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
devarasu07
Honored Contributor II

Re: Text color in red for calculated dimension

Hi,

Can you prepare mock data set and expected output in excel form. it's easy for us to check and help u. tks

ashissau
Contributor III

Re: Text color in red for calculated dimension

Hi Anil,

Both the expression in text box is giving me value 1 .

For some restriction I am not able to paste the image.