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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Adding a caluclated field while loading a file

Hi,

I am loading a table with from a file where i have one field with text values in it such as Month, Quarter, Year.

I am trying to calcluate a new field to show Value in nrs as follow

Name     Field A     Calculated Field

X            Monthly    12

Y            Quarter     4

Z             Year         1

My way of thinking to to have an if statement to create the field ...something like:

If Name = Monthly then 12

if Name = Quarter then 4

if name = year then 1

end as Frequency

I appreciate any help.

Thxs,

1 Solution

Accepted Solutions
mphekin12
Specialist
Specialist

Something like this may work for you:

if(Name='X',12,
      if(Name='Y',4,
            if(Name='Z',1,0)
      )
) as Frequency

or

if([Field A]='Monthly',12,
       if([Field A]='Quarter',4,
           if([Field A]='Year',1,0)
      )
) as Frequency

View solution in original post

2 Replies
mphekin12
Specialist
Specialist

Something like this may work for you:

if(Name='X',12,
      if(Name='Y',4,
            if(Name='Z',1,0)
      )
) as Frequency

or

if([Field A]='Monthly',12,
       if([Field A]='Quarter',4,
           if([Field A]='Year',1,0)
      )
) as Frequency

alec1982
Specialist II
Specialist II
Author

That's excactly what I am looking for!

Thxs,