Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
marishnagendran
Creator
Creator

Calculate Average in Column level

Dear All,

 

Last 5 daysQty
  
01/03/202020
02/03/202040
03/03/202020
04/03/202010
05/03/202025
06/03/202010

 

I want to color the column 1(Qty) based on average of last 5 days.

I.e

Avg is 21

will compare with each column and change the background of color.

 

Labels (4)
11 Replies
marishnagendran
Creator
Creator
Author

I'm also using same expression but it is not working.

And i have small doubt in Qty column in your application. Qty column is not calculated using SUM aggregate function. your are using that column like a dimension.

But in my model we calculate the overall sales for that day using expression like Sum(kpi_Qty). Thats why the expression is not working for me.

Better use measure column as qty and use that expression(Background expression) and let me know whether is working or not.

NitinK7
Specialist
Specialist

Hi,

it is working for me

see below screenshot

final.PNG

Background color expression

=if(Sum(Qty)>Avg(total Qty),Green(),White())

                or

=if(Aggr(Sum(Qty),days)>Avg(total Qty),Green(),White())