Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tejes
Contributor III
Contributor III

Background Color expression Calculation

Hello folks,

I have a Pivot table with the data and I tried to use Colormix1 in the background color expression but for some reason, it gives me a calculation timed out error. If I don't use any background color expression then the Pivot table works fine.  

BG color expression: ColorMix1(Count(distinct [all.party_gen_id])/ Count(distinct total [all.party_gen_id]),white(),cyan())

calc.PNG

Thank you.

Labels (2)
5 Replies
miskinmaz
Creator III
Creator III

can you post the sample app

jonathandienst
Partner - Champion III
Partner - Champion III

Doing a DISTINCT at different levels of granularity will produce a ratio of greater than one. The total level  will remove duplicates at a global level, where the numerator will remove duplicates  at a dimension level (the same value can exists in multiple rows. You need something like

Count(distinct [all.party_gen_id])/
Sum(Aggr(Count(distinct total [all.party_gen_id]), dimension))

Where dimension is the chart/table dimension(s)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tejes
Contributor III
Contributor III
Author

Hi Jonty,

Thank you for your reply,

As discussed above, I don't have any problem getting the values in the Pivot table but the problem is when I use colormix1 in background-color expression. It gives the error calculation timed out only when I use background color expression but without color expression, it works fine.

 

Than you.

 

jonathandienst
Partner - Champion III
Partner - Champion III

The colormix expects a value between 0 and 1. Your expression can produce values of more than one.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tejes
Contributor III
Contributor III
Author

Thank you, Jonty for your answer. I found a way to do it using ARGB in the colormix1.