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

consolidated if statement

Hi, I have a variety of if statements to pivot data like this:

    if(AttributeName='Challenge' AND AttributeValue, AttributeValue) as [Email New Inquiry Challenge],

     if(AttributeName='Forms' AND AttributeValue, AttributeValue) as [Email New Inquiry Forms],

     if(AttributeName='General Program' AND AttributeValue, AttributeValue) as [Email New Inquiry General Program],

     if(AttributeName='Gift Card' AND AttributeValue, AttributeValue) as [Email New Inquiry Gift Card],

Is there a single statement I can write to create these fields?  Something like this in concept:

if(AttributeName AND AttributeValue, AttributeValue) as ['Email New Inquiry '&vAttributeName']

I had to unpivot lots of data due to varying field headers to get it loaded, and am using the if statements above to re-pivot the data from a single table.  Many files have shifting names of operators for their field headers, or maybe a new inquiry type can be added etc, and I'd like the script to add new people itself without me having to keep track or anyone else having to communicate to me.

...and it just occurred to me the data sets for the particular dashboard that made me ask this question may not become too huge to just let a pivot table handle it, but still a correct answer to above would be helpful in other places where I do have huge data sets.

I will tap points to whoever solves above for me.

Thanks!

1 Solution

Accepted Solutions
Not applicable

Look for Generic and CrossTable statements.

regards

Darek

View solution in original post

3 Replies
Not applicable

Look for Generic and CrossTable statements.

regards

Darek

Not applicable

Hi Steve, Use Generic Load to Pivot the table. Please go through the below blog post as reference.

http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/31/generic

stevelord
Specialist
Specialist
Author

generic load was the one I was forgetting.  (It gave wonky results on a very large data set with unique qualities that I had to pivot with if statements, but looks okay for this.)