Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Partner - Master
Partner - Master

Change Background color on Rank

Hi,

is it possible to change the background color that depends on the Rank Value.

In my example I have 9 account and I want to show them in separate textobject. The textbox included '1050' should in this case be green. Is it possible for the textobject to know about the dimension outside the object it self? The expression is sum({$<Account={'50'}>}Value)

//Staffan2013-12-20_0752.png

1 Solution

Accepted Solutions
tresesco
MVP
MVP

21 Replies
rohit214
Creator III
Creator III


in text box>>properties >> colur>>caculate>> make expression

if(Account='50',Red())

thanks

rohit

stabben23
Partner - Master
Partner - Master
Author

Hi Rohit,

It has to be dynamic, tomorrow account 40 is highest.

//Staffan

tresesco
MVP
MVP

Is it that, you want to max value dynamically. PFA

Expression, something like (in text box):

=FirstSortedValue(Aggr(Sum(Amt),Months), -Aggr(Sum(Amt), Months))

stabben23
Partner - Master
Partner - Master
Author

if(Rank(aggr(sum(Value),Account))=1,lightGreen(),lightred()) is my calculated backgroundcolor that dont works right now.

stabben23
Partner - Master
Partner - Master
Author

Hi tresesco,

Not exact, I will get green in all the boxes with this expression

if(FirstSortedValue(Aggr(Sum(Value),Account), -Aggr(Sum(Value), Account)),Green(),red())

That is because this is the highest value in "just this textbox" it has to compare "outside the box" with all other Account values. Because all Account will be shown in there own textobject, and the highest sum(Value) should be green.

//Staffan

tresesco
MVP
MVP

Well, so your text boxes are specific to acounts.

Then try like:

If( Aggr(If(Account='50', Rank(Sum(Value))), Months) =1, lightgreen(), red())

If this doesn't work, please share your sample app.

stabben23
Partner - Master
Partner - Master
Author

Yes they are specific to Account, and I can not harcode 50 in my expression, because tomorrow it could be another Account with the highest Value. You can see on top in this discussion how it should be, this is just an example.

I havent "draw" all textboxes but have in mind that you have a Textobject for each Account. And the Account with the highest Value should be "Highligted" Green as you se in the table.

//staffan

rohit214
Creator III
Creator III


Hi ,

PFa

Hope it helps.

Thanks

Rohit

tresesco
MVP
MVP

Then how do you decide on number of text boxes? Is it something like: first text box for Rank 1, then second textbox for rank -2 ?
Please attach a sample app explaining the exact output.