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: 
rudywelvaert
Creator
Creator

background color dimension header pivot table

Hi,

How can the background color of the header of a dimension in a pivot table be changed according if one or more of the aggregated values along the other dimensions meets a certain criteria

e.g.

MonthCustomer managerJohnAnnieCharlesMariaPeterTotal
Aug 2014       20.912       34.909       41.260       31.829       54.049     203.704
Sep 2015       24.595       43.754       12.394       62.606      33.875     217.224
Oct 2015       38.706       55.654       26.034       23.341       52.395    175.385
Total       84.213     134.317     119.688     117.776     140.319     596.313

 

The criterium is value >= 50.000

In the aggregated values I use this for the background color:

=If ((Dimensionality() <> 0) and (SecondaryDimensionality() <> 0),If(Sum({<Month_From={"<=$(=Max(Month_From)) >=$(=AddMonths(Max(Month_From), -2))"}>} If((Month_From = Month_From _STARTDATE), OPEN_AMOUNT)) >= 50000, Pink()))


When I apply this formula also to the dimension Customer manager I get this result:

MonthCustomer managerJohnAnnieCharlesMariaPeterTotal
Aug 2014       20.912       34.909       41.260       31.829       54.049     203.704
Sep 2015       24.595       43.754       12.394       62.606      33.875     217.224
Oct 2015       38.706       55.654       26.034       23.341       52.395    175.385
Total       84.213     134.317     119.688     117.776     140.319     596.313


Only the Customer manager for whom the first value meets the criterium, gets the correct background color.

The Custom managers who have a value that meets the criterium in other values of the dimention Month, don't get the correct background color.


Tried to use the Agg() function over dimension Month, but Custom manager got a background color.


=If ((Dimensionality() <> 0) and (SecondaryDimensionality() <> 0),If(Max(Agg(Sum({<Month_From={"<=$(=Max(Month_From)) >=$(=AddMonths(Max(Month_From), -2))"}>} If((Month_From = Month_From _STARTDATE), OPEN_AMOUNT)),Month_From)) >= 50000, Pink()))


Any ideas?


Thanks


RW


4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you need use both the MonthFrom and CustomerManager dimensions in your aggr.

-Rob

anlonghi2
Creator II
Creator II

Hi Rudy,

please look at attached qvw.

I used the sample data in the attached excel.

Let me know.

Best regards

Andrea

rudywelvaert
Creator
Creator
Author

Thanks Rob

Do you mean this?

=If ((Dimensionality() <> 0) and (SecondaryDimensionality() <> 0),If(Max(Aggr(Sum({<Month_From={"<=$(=Max(Month_From)) >=$(=AddMonths(Max(Month_From), -2))"}>} If((Month_From = Month_From _STARTDATE), OPEN_AMOUNT)),Month_From,Customer_manager)) >= 50000, Pink()))

Because this doesn't work either

RW

rudywelvaert
Creator
Creator
Author

Grazie, Thanks,

In reality the case is a bit more complicated. The number of months shown, is variable (with a slider).

So aggregating with Max over a number of months can not be done before in the the script.

I can only make a table with total per Month_From and per Customer_manager.

The Maximum must be applied in the expression for the header color.

I haven't found it yet.

RW