Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

To Rename a field

I have a sales table consisting of following fields

Date

Dept   (AA,BB,CC,DD,EE,AB,AC)

Product

Sales Person

Amount

In the load script I want to merged two dept into one.

sales:

LOAD Date,

          if(Dept='AB','AA',if(Dept='AC'='CC'))as Dept,  //( AA+AB as one and AC and CC as one dept)

          Product,

          Sales Person,

          Amount

from sales.qvd

(qvd);

After the load I want to Dept dimension to consists of following Dept only.

AA,BB,CC,DD  but not the AB and AC

But in my output I get only AA and CC as dept.

Pls help me to solve this problem

1 Solution

Accepted Solutions
sebastiandperei
Specialist
Specialist

Hi. if you want to merge the AB to AA, and AC to CC, and the other to the same:


if(Dept='AB',

     'AA',

     if(Dept='AC',

          'CC',

          Dept))                    as Dept

View solution in original post

7 Replies
er_mohit
Master II
Master II

TRY THIS

if(wildmatch( Dept,'AA','BB','CC','DD','EE'),Dept) as Dept

hope it helps

amit_saini
Master III
Master III

Hi Upali,

You can do like this:

sales:

LOAD Date,

          if(Dept='AB','AA',if(Dept='AC'='CC'))as Dept,  //( AA+AB as one and AC and CC as one dept)

          Product,

          Sales Person,

          Amount

from sales.qvd

(qvd)

Where Dept<>AB and Dept<>AC;

Thanks,

AS

upaliwije
Creator II
Creator II
Author

Thanks

But It is not working as expected by. It does not show any dimension at all.

sebastiandperei
Specialist
Specialist

Hi. if you want to merge the AB to AA, and AC to CC, and the other to the same:


if(Dept='AB',

     'AA',

     if(Dept='AC',

          'CC',

          Dept))                    as Dept

amit_saini
Master III
Master III

Hi Upali,

Could you please share your data.

Thanks,

AS

chiru_thota
Specialist
Specialist

if(match(Dept,'AB','AA'),'AA',if(match(Dept,'AC','CC'),'CC',Dept)) as Dept2

upaliwije
Creator II
Creator II
Author

Thanks a lot