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

Announcements
Catch up on the newest Qlik features and improvements: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
samvile18
Creator III
Creator III

Colour Mix Expression not Working

Hello everyone - can someone help with the following expression please? I'm trying to add a heatmap to a pivot table and this background colour expression will not work at all:

=ColorMix1(
(Count(distinct {<[Next Product Flag] = {'Previous Product'}, [Other Product] = {1}>}[Held Master ID])
-
Min(TOTAL Aggr(Count(distinct {<[Next Product Flag] = {'Previous Product'}, [Other Product] = {1}>}[Held Master ID]), $(vHeldDimension), $(vHoldingDimension))))
/
(Max(TOTAL Aggr(Count(distinct {<[Next Product Flag] = {'Previous Product'}, [Other Product] = {1}>}[Held Master ID]), $(vHeldDimension), $(vHoldingDimension)))
-
Min(TOTAL Aggr(Count(distinct {<[Next Product Flag] = {'Previous Product'},[Other Product] = {1}>}[Held Master ID]), $(vHeldDimension), $(vHoldingDimension)))),

RGB(240, 249, 255),
RGB(8, 81, 156)
)

The two dimensions are controlled by a variable input so the user can easily switch between what dimension they view with the pivot table. 

 

Any help is greatly appreciated

1 Solution

Accepted Solutions
Or
MVP
MVP

You can definitely attach files here, but I'm not sure if you can attach QVF/QVWs. 

Lacking access to what needs to actually be tested, I'd go back to my original recommendation - try to split this into parts and see what each one does. If you can isolate the part that's not returning anything, or returning unexpected outputs, it'll be easier to focus on what needs fixing. Add each expression as a measure first, and if that doesn't do it, add them as calculated dimensions (which actually reflects things better in this context); For the expressions that aren't aggr()'d, just add an aggr for the entire table. 

View solution in original post

4 Replies
Or
MVP
MVP

This isn't enough information to be able to tell for sure - because of the aggr() aspect, not knowing the exact pivot table structure means there's no way for us to know what exactly is getting calculated in the regular count vs the aggr() expressions. 

One thing I'd check in either case - make sure the first value being passed to colormix (that's the big expression) always runs between 0 and 1, otherwise - it'll never work correctly. 

Splitting this into chunks so you can see the output value for each part of the expression is likely the best way to troubleshoot it. 

samvile18
Creator III
Creator III
Author

Apologies - the main count of the pivot table is:

Count(distinct {<
[Other Product] = {1}
>}[Held Master ID])

I'm unsure how to add an example QVF as that would probably make it easier.

Or
MVP
MVP

You can definitely attach files here, but I'm not sure if you can attach QVF/QVWs. 

Lacking access to what needs to actually be tested, I'd go back to my original recommendation - try to split this into parts and see what each one does. If you can isolate the part that's not returning anything, or returning unexpected outputs, it'll be easier to focus on what needs fixing. Add each expression as a measure first, and if that doesn't do it, add them as calculated dimensions (which actually reflects things better in this context); For the expressions that aren't aggr()'d, just add an aggr for the entire table. 

samvile18
Creator III
Creator III
Author

Thank you ever so much for the advice - I'll try that approach and see where I get to. Thank you.