Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Annu
Contributor
Contributor

Highlight cells in a table using aggr function

I want to highlight cells in the field "Total Miles" if the value is less than 10 percentage of average value of total miles grouped by subdivision. I used the following script, but is not working.  Please help me to find what is wrong with my code?

if(TOT_MILES < aggr(avg(TOT_MILES), SBDVSN)*.1, Rgb(254,136,133),Rgb(138,245,126))

Thanks.

Labels (4)
1 Solution

Accepted Solutions
sidhiq91
Specialist II
Specialist II

@Annu Please find the code below:

NoConcatenate
Temp:
load * inline [
Subdivision, totalmiles
Cabs,100
Cabs,150
Cabs,75
Shuttle,140
Shuttle,120
Shuttle,110
VIPpickup,40
VIPpickup,35
VIPpickup,30
];

Exit Script;

if(totalmiles<Avg(total <Subdivision>totalmiles),red(),green())

sidhiq91_0-1676708780520.png

If this resolves your issue, please like and accept it as a solution.

View solution in original post

2 Replies
sidhiq91
Specialist II
Specialist II

@Annu Please find the code below:

NoConcatenate
Temp:
load * inline [
Subdivision, totalmiles
Cabs,100
Cabs,150
Cabs,75
Shuttle,140
Shuttle,120
Shuttle,110
VIPpickup,40
VIPpickup,35
VIPpickup,30
];

Exit Script;

if(totalmiles<Avg(total <Subdivision>totalmiles),red(),green())

sidhiq91_0-1676708780520.png

If this resolves your issue, please like and accept it as a solution.

Annu
Contributor
Contributor
Author

Yes it worked. Thanks for the code. 

I am wondering why the aggr function didn't work as it is a group by function?