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

Coloring by hardcoded calculation in straight table

hi all,

Within the load script, I have a fixed list of KPIs for changes in customer counts: Breakdown by Last Day, Change compared to Previous Month, Change compared to Year End, Difference from Previous Month, Difference from Year End. Based on this list, I calculate customer counts and change rates for each segment. I present the results in a straight table. An example calculation looks like this:

 

if(kpi='1', num(sum({<tarih={"$(=Max(Tarih))"}, segment={'a'}>} musteri_adedi)

/ sum({<tarih={"$(=Max(Tarih))"}>} musteri_adedi)),'0.0%'), if(kpi='2',num(sum({<tarih={"$(=Max(Tarih))"}, segment={'a'}>} musteri_adedi) - sum({<period={'last month'}, segment={'a'}>} musteri_adedi)) / sum({<period={'last month'}, segment={'a'}>} musteri_adedi)),'0.0%)... It continues like this.

Here, I'd like to implement a text color scheme where if the result of each calculation is greater than 0, it's displayed in green, and if it's less than 0, it's displayed in red. How can we achieve this? 

I appreciate the help as always...

Labels (2)
1 Solution

Accepted Solutions
brunobertels
Master
Master

hi may be like this 

if(column(2)<0,LightRed(),LightGreen())

View solution in original post

6 Replies
brunobertels
Master
Master

Hi

try this

lets say your calculation column is the column 2 of your straight table then 

if(column(2)<'0',LightRed(),LightGreen())

kasimyc
Contributor III
Contributor III
Author

It appears green at negative values. Unfortunately, the red did not appear

brunobertels
Master
Master

hi may be like this 

if(column(2)<0,LightRed(),LightGreen())

kasimyc
Contributor III
Contributor III
Author

like this

kasimyc_0-1710501064901.png

kasimyc
Contributor III
Contributor III
Author

In the expression, the use of quotation marks doesn't have any effect. I'm getting the same result in both cases.

kasimyc
Contributor III
Contributor III
Author

I'm sorry, I used the column name incorrectly, but I fixed it. Your suggested solution gave me exactly what I was looking for. I'm grateful.