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

How to show customized records base on conditions in Chart Object

Hello,

I have a field called "Initial/Follow-up" which associate with "Case ID" etc. The records in this field are number. "0" means "Initial", "1...to other number" means "Follow-up times", like this,

Initial/Follow-up

          0

         1

         0

         2

         5

         0

I would like to show "Initial" and "Follow-up num" as the record values, such as

Initial/Follow-up

         Initial

         FU#1

         Initial

         FU#2

         FU#5

         Initial

I created expression for the "Initial/Follow-up" field, if([Initial/Follow-up]=0,'Initial','FU#' & [Initial/Follow-up]) . But this doesn't work for Follow-ups, shows as below,

What can I do to get the FU number?

Thanks,

Becky

1 Solution

Accepted Solutions
sunny_talwar

Seems to be working for the sample here:

Capture.PNG

Table:

LOAD *,

  if([Initial/Follow-up]=0,'Initial','FU#' & [Initial/Follow-up]) AS NewField;

LOAD * Inline [

Initial/Follow-up

          0

         1

         0

         2

         5

         0

         ];

View solution in original post

22 Replies
sunny_talwar

Seems to be working for the sample here:

Capture.PNG

Table:

LOAD *,

  if([Initial/Follow-up]=0,'Initial','FU#' & [Initial/Follow-up]) AS NewField;

LOAD * Inline [

Initial/Follow-up

          0

         1

         0

         2

         5

         0

         ];

Not applicable
Author

Thanks for the idea Sunny.

But the thing is the number I listed above is only for example. In the table there are thousands of numbers. Let's say the range of those numbers right now is from 0 to 10 follow-ups. In the future the num. of follow-ups could increase, such as from 0 to 12 follow-ups. Is there a better way to handle this?

sunny_talwar

Regardless of how many number of "Initial/Follow-up" you might have, you if statement should work.

Not applicable
Author

Well, the inline load didn't work and won't work. As I don't know the order of the number. Or maybe I didn't really undertand that way you suggested.

But the good news is, I got it work by adding " if([Initial/Follow-up]=0,'Initial','FU#' & [Initial/Follow-up]) as [Initial/Follow-up] " in the Load data statement..

Thank you ,

Becky

sunny_talwar

Adding what? Single quote? I thought it was always there... No?

swuehl
MVP
MVP

Sunny, I guess the problem was the use of the statement as expression in a table chart where the field values were not unambiguous within the dimensional scope.

Use Aggregation Functions!

Maybe like

=if(Max([Initial/Follow-up])=0,'Initial','FU#' & Max([Initial/Follow-up]))

Not applicable
Author

I meant I didn't use the Inline load becuase it didn't work. I only add this line into load script:  " if([Initial/Follow-up]=0,'Initial','FU#' & [Initial/Follow-up]) as [Initial/Follow-up] ".

It works just by doing this.

sunny_talwar

Super.... If you got what you wanted, please close this thread down by marking correct and helpful responses.

https://community.qlik.com/docs/DOC-14806

Best,

Sunny

Not applicable
Author

Your first response was partial correct, as the inline load wasn't working. So I made it as helpful. I am happy to know if you have different opinion based on the action I make. Thanks again.