Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color Mix Not updating background colors

Hello,

Can someone tell me what is wrong with this code?  I'm trying to create background colors (mimic Excel) over a range of values (Ratio).  I would like to set it up so

Upper is Max(Ratio)

Lower is Min(Ratio)

Intermediate is in between Upper and Lower

My code isn't working and I don't understand why.

I have attached an example.

Appreciate some help, please!

12 Replies
MK_QSL
MVP
MVP

Instead of Ratio, use SUM(Ratio) as Expression

Now Upper Limit and Lower Limit use as below

Max(Total Ratio)

Min(Total Ratio)

Not applicable
Author

Thanks for the quick response!  In my real application the Ratio is a variable.  When I duplicate this in the app using the variable it does not place any background color on the table.

Sum($(vDocRatio))

Max(TOTAL $(vDocRatio))

Min(TOTAL $(vDocRatio))

Anonymous
Not applicable
Author

Hey LR,

Please find attached qvw.

It is working infact. only issue is in your data you are having 0 values for Dimension value 'D' which is being supressed with default setting(suppress zero values). that's the reason you are not able to find the color setting for minimum value.

I have unchecked that check box.

Regards,

Chinna

Not applicable
Author

I can successfully make it work in my sample but when I apply to my other application, it's not working.

I have a variable (vDocRatio) set up that calculates the ratio.  It's defined

Avg({<DateComp={'Post'},[Issue in Exchg]={'N'}>}[Ttl Doc Amt USD]) / Avg({<DateComp={'Prior'},[Issue in Exchg]={'N'}>}[Ttl Doc Amt USD])

In color mix wizard, when I try to Sum($(vDocRatio)) I get no background color.

ColorMix1 ((1+Sign(2*(Sum($(vDocRatio))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))/(RangeMax (top(total Sum($(vDocRatio)),1,NoOfRows(total)))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))-1)*Sqrt(Fabs((2*(Sum($(vDocRatio))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))/(RangeMax (top(total Sum($(vDocRatio)),1,NoOfRows(total)))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))-1))))/2, ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0))

Not applicable
Author

I can successfully make it work in my sample but when I apply to my other application, it's not working.

I have a variable (vDocRatio) set up that calculates the ratio.  It's defined

Avg({<DateComp={'Post'},[Issue in Exchg]={'N'}>}[Ttl Doc Amt USD]) / Avg({<DateComp={'Prior'},[Issue in Exchg]={'N'}>}[Ttl Doc Amt USD])

In color mix wizard, when I try to Sum($(vDocRatio)) I get no background color.

ColorMix1 ((1+Sign(2*(Sum($(vDocRatio))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))/(RangeMax (top(total Sum($(vDocRatio)),1,NoOfRows(total)))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))-1)*Sqrt(Fabs((2*(Sum($(vDocRatio))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))/(RangeMax (top(total Sum($(vDocRatio)),1,NoOfRows(total)))-RangeMin (top(total Sum($(vDocRatio)),1,NoOfRows(total))))-1))))/2, ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0))

Anonymous
Not applicable
Author

Dear L R,

Please share your app, if possible.

Try to do following.

Try by removing sum in color mix wizard.

try the variable calculation directly in color mix wizard

Regards,

Chinna

Not applicable
Author

Hello Chinna,

Attached is sample of what I'm referring to with the variables not working when attempting to set the background color.  I've also tried using the expression contained in the variables.

Anonymous
Not applicable
Author

Dear LR,

PFA. it is working now.

Not applicable
Author

Hello Chinna

Almost there.  I need to be able to set Upper, Lower and intermediate expressions for the background color.  I tried using Max and Min like suggested above but I get an error in the expression.  Suggestions?

Max(Total Avg({<DateComp={'Post'},[Exchanged]={'N'}>}[Amount]) / Avg({<DateComp={'Prior'},[Exchanged]={'N'}>}[Amount]))

Min(Total Avg({<DateComp={'Post'},[Exchanged]={'N'}>}[Amount]) / Avg({<DateComp={'Prior'},[Exchanged]={'N'}>}[Amount]))

Then for intermediate I need to max + min / 2

Thanks for your help!