Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
sgrobben
Contributor II
Contributor II

Colored bars in a table

I have a table with admission periods (see attachment). 

The [Admission period current admission (days)] is the following dimension:

 

ProcessingTime

 

The [Admission period last admission (days)] is the following dimension:

 

ProcessingTimeLastAdmission

 

The [Total admission period (days)] is calculated as follows:

 

Max(ProcessingTime)
+
If(IsNull(Max(ProcessingTimeLastAdmission)),0,Max(ProcessingTimeLastAdmission))

 

The bar graph in the table is the [Total admission period] in days and is created as follows:

 

Repeat('▇'
,
Max(ProcessingTime)
+
If(IsNull(Max(ProcessingTimeLastAdmission)),0,Max(ProcessingTimeLastAdmission))
)

 

So far, so great! Now i want to give the cubes who are from the last admission period a different color. For example, if the admission period from the current admission is 4 days and the admission period from the last admission is 1 day, i want 1 red cube and 4 green cubes.

How do i do this?

Thanks in advance!

Labels (1)
1 Solution

Accepted Solutions
KGalloway
Creator II
Creator II

Would something like the following work?

=repeat('🟩', max(B)) & repeat('🟥', coalesce(max(C), 0))

KGalloway_0-1674248745402.png

Also, I think the coalesce function will work better for your if statement. It returns the first non-null argument.

View solution in original post

5 Replies
KGalloway
Creator II
Creator II

Would something like the following work?

=repeat('🟩', max(B)) & repeat('🟥', coalesce(max(C), 0))

KGalloway_0-1674248745402.png

Also, I think the coalesce function will work better for your if statement. It returns the first non-null argument.

sgrobben
Contributor II
Contributor II
Author

Hi, KGalloway,

The coalesce function works perfectly for the non-null values. I inserted your code in the [Expression] field. I guess that i also have to insert something in the [Expression text color] field to make the colors visible, right?

If so, what code did you insert here to make the difference between the red and the green color?

Thanks in advance!

KGalloway
Creator II
Creator II

I used =repeat('🟩', max(B)) & repeat('🟥', coalesce(max(C), 0)) in the [Expression] field. I did copy the green and red square characters from unicode sources I found through google. I didn't have to insert anything in the [Expression text color] field.

 

KGalloway_0-1674482843795.png

 

mikaelsc
Specialist
Specialist

emoji's are your friends 🙂

https://emojipedia.org/search/?q=square 

sgrobben
Contributor II
Contributor II
Author

Thanks!