Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ashis
Creator III
Creator 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
Anil_Babu_Samineni

Perhaps this?

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

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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)
ashis
Creator III
Creator III
Author

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
Master II
Master II

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

ashis
Creator III
Creator III
Author

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
Master II
Master II

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())

ashis
Creator III
Creator III
Author

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

Anil_Babu_Samineni

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?

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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
Master II
Master II

Hi,

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

ashis
Creator III
Creator III
Author

Hi Anil,

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

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